#include "media/gpu/test/video_player/decoder_wrapper.h"
#include <string>
#include <utility>
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/single_thread_task_runner_thread_mode.h"
#include "base/task/thread_pool.h"
#include "build/build_config.h"
#include "gpu/config/gpu_driver_bug_workarounds.h"
#include "media/base/media_switches.h"
#include "media/base/media_util.h"
#include "media/base/waiting.h"
#include "media/gpu/macros.h"
#include "media/gpu/test/video_bitstream.h"
#include "media/gpu/test/video_frame_helpers.h"
#include "media/gpu/test/video_player/frame_renderer_dummy.h"
#include "media/gpu/test/video_player/test_vda_video_decoder.h"
#include "media/gpu/test/video_test_helpers.h"
#include "media/media_buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION)
#include "media/gpu/chromeos/platform_video_frame_pool.h"
#include "media/gpu/chromeos/video_decoder_pipeline.h"
#endif
namespace media {
namespace test {
namespace {
template <typename F, typename... Args>
void CallbackThunk(std::optional<base::WeakPtr<DecoderWrapper>> decoder_client,
scoped_refptr<base::SequencedTaskRunner> task_runner,
F f,
Args... args) { … }
}
DecoderWrapper::DecoderWrapper(
const DecoderListener::EventCallback& event_cb,
std::unique_ptr<FrameRendererDummy> renderer,
std::vector<std::unique_ptr<VideoFrameProcessor>> frame_processors,
const DecoderWrapperConfig& config)
: … { … }
DecoderWrapper::~DecoderWrapper() { … }
std::unique_ptr<DecoderWrapper> DecoderWrapper::Create(
const DecoderListener::EventCallback& event_cb,
std::unique_ptr<FrameRendererDummy> frame_renderer,
std::vector<std::unique_ptr<VideoFrameProcessor>> frame_processors,
const DecoderWrapperConfig& config) { … }
void DecoderWrapper::CreateDecoder() { … }
bool DecoderWrapper::WaitForFrameProcessors() { … }
void DecoderWrapper::WaitForRenderer() { … }
void DecoderWrapper::Initialize(const VideoBitstream* video) { … }
void DecoderWrapper::Play() { … }
void DecoderWrapper::Flush() { … }
void DecoderWrapper::Reset() { … }
void DecoderWrapper::CreateDecoderTask(base::WaitableEvent* done) { … }
void DecoderWrapper::InitializeTask(const VideoBitstream* video,
base::WaitableEvent* done) { … }
void DecoderWrapper::DestroyDecoderTask(base::WaitableEvent* done) { … }
void DecoderWrapper::PlayTask() { … }
void DecoderWrapper::DecodeNextFragmentTask() { … }
void DecoderWrapper::FlushTask() { … }
void DecoderWrapper::ResetTask() { … }
void DecoderWrapper::OnDecoderInitializedTask(DecoderStatus status) { … }
void DecoderWrapper::OnDecodeDoneTask(DecoderStatus status) { … }
void DecoderWrapper::OnFrameReadyTask(scoped_refptr<VideoFrame> video_frame) { … }
void DecoderWrapper::OnFlushDoneTask(DecoderStatus status) { … }
void DecoderWrapper::OnResetDoneTask() { … }
bool DecoderWrapper::OnResolutionChangedTask() { … }
bool DecoderWrapper::FireEvent(DecoderListener::Event event) { … }
}
}