#include "mediapipe/framework/packet_generator_graph.h"
#include <deque>
#include <functional>
#include <memory>
#include <utility>
#include "absl/strings/str_cat.h"
#include "absl/strings/str_join.h"
#include "absl/synchronization/mutex.h"
#include "mediapipe/framework/delegating_executor.h"
#include "mediapipe/framework/executor.h"
#include "mediapipe/framework/packet_generator.h"
#include "mediapipe/framework/packet_type.h"
#include "mediapipe/framework/port.h"
#include "mediapipe/framework/port/canonical_errors.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/framework/port/proto_ns.h"
#include "mediapipe/framework/port/ret_check.h"
#include "mediapipe/framework/port/status_builder.h"
#include "mediapipe/framework/thread_pool_executor.h"
#include "mediapipe/framework/tool/status_util.h"
namespace mediapipe {
namespace {
absl::Status CreateInputsForGenerator(
const ValidatedGraphConfig& validated_graph, int generator_index,
const std::map<std::string, Packet>& side_packets,
PacketSet* input_side_packet_set, bool* unrunnable) { … }
absl::Status Generate(const ValidatedGraphConfig& validated_graph,
int generator_index,
const PacketSet& input_side_packet_set,
PacketSet* output_side_packet_set) { … }
class GeneratorScheduler { … };
GeneratorScheduler::GeneratorScheduler(
const ValidatedGraphConfig* validated_graph, mediapipe::Executor* executor,
const std::vector<int>& non_base_generators, bool initial)
: … { … }
void GeneratorScheduler::GenerateAndScheduleNext(
int generator_index, std::map<std::string, Packet>* side_packets,
std::unique_ptr<PacketSet> input_side_packet_set) { … }
void GeneratorScheduler::ScheduleAllRunnableGenerators(
std::map<std::string, Packet>* side_packets) { … }
void GeneratorScheduler::WaitUntilIdle() { … }
absl::Status GeneratorScheduler::GetNonScheduledGenerators(
std::vector<int>* non_scheduled_generators) const { … }
void GeneratorScheduler::AddApplicationThreadTask(std::function<void()> task) { … }
void GeneratorScheduler::RunApplicationThreadTasks() { … }
}
PacketGeneratorGraph::~PacketGeneratorGraph() { … }
absl::Status PacketGeneratorGraph::Initialize(
const ValidatedGraphConfig* validated_graph, mediapipe::Executor* executor,
const std::map<std::string, Packet>& input_side_packets) { … }
absl::Status PacketGeneratorGraph::RunGraphSetup(
const std::map<std::string, Packet>& input_side_packets,
std::map<std::string, Packet>* output_side_packets,
std::vector<int>* non_scheduled_generators) const { … }
absl::Status PacketGeneratorGraph::ExecuteGenerators(
std::map<std::string, Packet>* output_side_packets,
std::vector<int>* non_scheduled_generators, bool initial) const { … }
}