#include "mediapipe/tasks/cc/core/task_runner.h"
#include <algorithm>
#include <atomic>
#include <functional>
#include <iterator>
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "absl/memory/memory.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/substitute.h"
#include "absl/synchronization/mutex.h"
#include "mediapipe/framework/calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/executor.h"
#include "mediapipe/framework/port/status_macros.h"
#include "mediapipe/framework/tool/name_util.h"
#include "mediapipe/tasks/cc/common.h"
#include "mediapipe/tasks/cc/core/model_resources_cache.h"
#include "tensorflow/lite/core/api/op_resolver.h"
#if !MEDIAPIPE_DISABLE_GPU
#include "mediapipe/gpu/gpu_shared_data_internal.h"
#endif
namespace mediapipe {
namespace tasks {
namespace core {
namespace {
absl::StatusOr<Timestamp> ValidateAndGetPacketTimestamp(
const PacketMap& packet_map) { … }
absl::StatusOr<PacketMap> GenerateOutputPacketMap(
const std::vector<Packet>& packets,
const std::vector<std::string>& stream_names) { … }
}
#if !MEDIAPIPE_DISABLE_GPU
absl::StatusOr<std::unique_ptr<TaskRunner>> TaskRunner::Create(
CalculatorGraphConfig config,
std::unique_ptr<tflite::OpResolver> op_resolver,
PacketsCallback packets_callback,
std::shared_ptr<Executor> default_executor,
std::optional<PacketMap> input_side_packets,
std::shared_ptr<::mediapipe::GpuResources> resources,
std::optional<ErrorFn> error_fn, bool disable_default_service) {
#else
absl::StatusOr<std::unique_ptr<TaskRunner>> TaskRunner::Create(
CalculatorGraphConfig config,
std::unique_ptr<tflite::OpResolver> op_resolver,
PacketsCallback packets_callback,
std::shared_ptr<Executor> default_executor,
std::optional<PacketMap> input_side_packets,
std::optional<ErrorFn> error_fn, bool disable_default_service) { … }
absl::Status TaskRunner::Initialize(
CalculatorGraphConfig config,
std::unique_ptr<tflite::OpResolver> op_resolver,
std::shared_ptr<Executor> default_executor,
std::optional<PacketMap> input_side_packets,
std::optional<ErrorFn> error_fn, bool disable_default_service) { … }
absl::Status TaskRunner::Start() { … }
absl::StatusOr<PacketMap> TaskRunner::Process(PacketMap inputs) { … }
absl::Status TaskRunner::Send(PacketMap inputs) { … }
absl::Status TaskRunner::Close() { … }
absl::Status TaskRunner::Restart() { … }
}
}
}