#include "media/gpu/test/image_processor/image_processor_client.h"
#include <functional>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/synchronization/waitable_event.h"
#include "base/task/bind_post_task.h"
#include "build/build_config.h"
#include "media/base/video_frame.h"
#include "media/base/video_frame_layout.h"
#include "media/gpu/chromeos/fourcc.h"
#include "media/gpu/chromeos/image_processor_factory.h"
#include "media/gpu/chromeos/platform_video_frame_utils.h"
#include "media/gpu/test/image.h"
#include "media/gpu/test/video_frame_helpers.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/rect.h"
namespace media {
namespace test {
namespace {
#define ASSERT_TRUE_OR_RETURN_NULLPTR(predicate) …
std::optional<VideoFrameLayout> CreateLayout(
const ImageProcessor::PortConfig& config) { … }
}
std::unique_ptr<ImageProcessorClient> ImageProcessorClient::Create(
std::optional<ImageProcessor::CreateBackendCB> create_backend_cb,
const ImageProcessor::PortConfig& input_config,
const ImageProcessor::PortConfig& output_config,
size_t num_buffers,
std::vector<std::unique_ptr<VideoFrameProcessor>> frame_processors) { … }
ImageProcessorClient::ImageProcessorClient(
std::vector<std::unique_ptr<VideoFrameProcessor>> frame_processors)
: … { … }
ImageProcessorClient::~ImageProcessorClient() { … }
bool ImageProcessorClient::CreateImageProcessor(
std::optional<ImageProcessor::CreateBackendCB> create_backend_cb,
const ImageProcessor::PortConfig& input_config,
const ImageProcessor::PortConfig& output_config,
size_t num_buffers) { … }
void ImageProcessorClient::CreateImageProcessorTask(
std::optional<ImageProcessor::CreateBackendCB> create_backend_cb,
const ImageProcessor::PortConfig& input_config,
const ImageProcessor::PortConfig& output_config,
size_t num_buffers,
base::WaitableEvent* done) { … }
scoped_refptr<VideoFrame> ImageProcessorClient::CreateInputFrame(
const Image& input_image) const { … }
scoped_refptr<VideoFrame> ImageProcessorClient::CreateOutputFrame(
const Image& output_image) const { … }
void ImageProcessorClient::FrameReady(size_t frame_index,
scoped_refptr<VideoFrame> frame) { … }
bool ImageProcessorClient::WaitUntilNumImageProcessed(
size_t num_processed,
base::TimeDelta max_wait) { … }
bool ImageProcessorClient::WaitForFrameProcessors() { … }
size_t ImageProcessorClient::GetNumOfProcessedImages() const { … }
size_t ImageProcessorClient::GetErrorCount() const { … }
void ImageProcessorClient::NotifyError() { … }
void ImageProcessorClient::Process(const Image& input_image,
const Image& output_image) { … }
void ImageProcessorClient::ProcessTask(scoped_refptr<VideoFrame> input_frame,
scoped_refptr<VideoFrame> output_frame) { … }
}
}