Commit a1d47a7f authored by Vladislav Kuzkokov's avatar Vladislav Kuzkokov Committed by Commit Bot

Revert "media/gpu: make VideoDecoderPipeline select VD implementation during Initialize()."

This reverts commit cae62756.

Reason for revert: Breaks build with target_os="chromeos"

FAILED: libmedia_gpu.so libmedia_gpu.so.TOC
python "../../build/toolchain/gcc_solink_wrapper.py" --readelf="readelf" --nm="nm" --sofile="./libmedia_gpu.so" --tocfile="./libmedia_gpu.so.TOC" --output="./libmedia_gpu.so" -- ../../third_party/llvm-build/Release+Asserts/bin/clang++ -shared -Wl,-soname="libmedia_gpu.so" -Wl,--fatal-warnings -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,defs -Wl,--as-needed -fuse-ld=lld -Wl,--color-diagnostics -m64 -Werror -Wl,--gdb-index -nostdlib++ --sysroot=../../build/linux/debian_sid_amd64-sysroot -L../../build/linux/debian_sid_amd64-sysroot/usr/local/lib/x86_64-linux-gnu -L../../build/linux/debian_sid_amd64-sysroot/lib/x86_64-linux-gnu -L../../build/linux/debian_sid_amd64-sysroot/usr/lib/x86_64-linux-gnu -Wl,-rpath=\$ORIGIN -Wl,-rpath=\$ORIGIN -o "./libmedia_gpu.so" @"./libmedia_gpu.so.rsp"
ld.lld: error: undefined symbol: media::VideoDecoderPipeline::Create(scoped_refptr<base::SequencedTaskRunner>, std::__Cr::unique_ptr<media::DmabufVideoFramePool, std::__Cr::default_delete<media::DmabufVideoFramePool> >, std::__Cr::unique_ptr<media::VideoFrameConverter, std::__Cr::default_delete<media::VideoFrameConverter> >)
>>> referenced by chromeos_video_decoder_factory.cc:54 (../../media/gpu/chromeos/chromeos_video_decoder_factory.cc:54)
>>>               obj/media/gpu/chromeos/chromeos/chromeos_video_decoder_factory.o:(media::ChromeosVideoDecoderFactory::Create(scoped_refptr<base::SequencedTaskRunner>, std::__Cr::unique_ptr<media::DmabufVideoFramePool, std::__Cr::default_delete<media::DmabufVideoFramePool> >, std::__Cr::unique_ptr<media::VideoFrameConverter, std::__Cr::default_delete<media::VideoFrameConverter> >))
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Original change's description:
> media/gpu: make VideoDecoderPipeline select VD implementation during Initialize().
>
> Some devices select the video decoder implementation by the video
> configuration (e.g. codec). VideoDecoderPipeline needs to select a
> proper video decoder in Initialize() when a video configuration is
> specified.
>
> This CL implements the mechanism of selecting VD at Initialize()
> instead of Create() method.
>
> BUG=chromium:952730
> TEST=Run video_decode_accelerator_tests on Kevin and Eve
>
> Change-Id: I76077df0bc1e1eeae730e618a62c6e1049e02500
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1708693
> Reviewed-by: David Staessens <dstaessens@chromium.org>
> Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
> Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
> Commit-Queue: Chih-Yu Huang <akahuang@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#691946}

TBR=deanliao@chromium.org,akahuang@chromium.org,hiroh@chromium.org,acourbot@chromium.org,dstaessens@chromium.org

Change-Id: I2edea554734a766fce1d61943297547159c8cbeb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:952730
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1778048Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: default avatarVladislav Kuzkokov <vkuzkokov@chromium.org>
Commit-Queue: Vladislav Kuzkokov <vkuzkokov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#692035}
parent d430a3a7
......@@ -22,7 +22,7 @@ source_set("chromeos") {
]
if (use_vaapi || use_v4l2_codec) {
deps += [ "//media/gpu/linux" ]
deps += [ "//media/gpu/linux:common" ]
}
if (use_vaapi) {
......
......@@ -11,7 +11,6 @@
#include "media/gpu/buildflags.h"
#include "media/gpu/linux/mailbox_video_frame_converter.h"
#include "media/gpu/linux/platform_video_frame_pool.h"
#include "media/gpu/linux/video_decoder_pipeline.h"
#if BUILDFLAG(USE_VAAPI)
#include "media/gpu/vaapi/vaapi_video_decoder.h"
......@@ -21,6 +20,9 @@
#include "media/gpu/v4l2/v4l2_slice_video_decoder.h"
#endif
#if BUILDFLAG(USE_VAAPI) || BUILDFLAG(USE_V4L2_CODEC)
#include "media/gpu/linux/video_decoder_pipeline.h"
#endif
namespace media {
......@@ -50,10 +52,29 @@ std::unique_ptr<VideoDecoder> ChromeosVideoDecoderFactory::Create(
scoped_refptr<base::SequencedTaskRunner> client_task_runner,
std::unique_ptr<DmabufVideoFramePool> frame_pool,
std::unique_ptr<VideoFrameConverter> frame_converter) {
// TODO(akahuang): Remove ChromeosVideoDecoderFactory.
return VideoDecoderPipeline::Create(std::move(client_task_runner),
std::move(frame_pool),
std::move(frame_converter));
if (!client_task_runner || !frame_pool || !frame_converter)
return nullptr;
std::unique_ptr<VideoDecoder> decoder;
// TODO(dstaessens@): We first try VAAPI as USE_V4L2_CODEC might also be
// set, even though initialization of V4L2SliceVideoDecoder would fail. We
// need to implement a better way to select the correct decoder.
#if BUILDFLAG(USE_VAAPI)
decoder =
VaapiVideoDecoder::Create(client_task_runner, std::move(frame_pool));
#elif BUILDFLAG(USE_V4L2_CODEC)
decoder =
V4L2SliceVideoDecoder::Create(client_task_runner, std::move(frame_pool));
#endif
#if BUILDFLAG(USE_VAAPI) || BUILDFLAG(USE_V4L2_CODEC)
return std::make_unique<VideoDecoderPipeline>(std::move(client_task_runner),
std::move(decoder),
std::move(frame_converter));
#else
return nullptr;
#endif
}
} // namespace media
......@@ -7,36 +7,6 @@ import("//media/gpu/args.gni")
assert(use_v4l2_codec || use_vaapi)
# The source that depends on //media/gpu/{vaapi,v4l2}. It is created to avoid
# circular dependency because //media/gpu/linux:common could be depended by
# //media/gpu/{vaapi,v4l2}.
source_set("linux") {
defines = [ "MEDIA_GPU_IMPLEMENTATION" ]
sources = [
"video_decoder_pipeline.cc",
"video_decoder_pipeline.h",
]
public_deps = [
":common",
]
deps = [
"//base",
"//media",
"//media/gpu:buildflags",
"//media/gpu:common",
]
if (use_vaapi) {
deps += [ "//media/gpu/vaapi" ]
}
if (use_v4l2_codec) {
deps += [ "//media/gpu/v4l2" ]
}
}
source_set("common") {
defines = [ "MEDIA_GPU_IMPLEMENTATION" ]
sources = [
......@@ -48,6 +18,8 @@ source_set("common") {
"platform_video_frame_pool.h",
"platform_video_frame_utils.cc",
"platform_video_frame_utils.h",
"video_decoder_pipeline.cc",
"video_decoder_pipeline.h",
]
deps = [
......
This diff is collapsed.
......@@ -7,12 +7,10 @@
#include <memory>
#include "base/containers/queue.h"
#include "base/memory/weak_ptr.h"
#include "base/optional.h"
#include "base/sequence_checker.h"
#include "media/base/video_decoder.h"
#include "media/base/video_decoder_config.h"
#include "media/gpu/media_gpu_export.h"
#include "media/gpu/video_frame_converter.h"
......@@ -22,15 +20,12 @@ class SequencedTaskRunner;
namespace media {
class DmabufVideoFramePool;
class MEDIA_GPU_EXPORT VideoDecoderPipeline : public VideoDecoder {
public:
static std::unique_ptr<VideoDecoder> Create(
VideoDecoderPipeline(
scoped_refptr<base::SequencedTaskRunner> client_task_runner,
std::unique_ptr<DmabufVideoFramePool> frame_pool,
std::unique_ptr<VideoDecoder> decoder,
std::unique_ptr<VideoFrameConverter> frame_converter);
~VideoDecoderPipeline() override;
// VideoDecoder implementation
......@@ -50,35 +45,7 @@ class MEDIA_GPU_EXPORT VideoDecoderPipeline : public VideoDecoder {
void Decode(scoped_refptr<DecoderBuffer> buffer, DecodeCB decode_cb) override;
private:
// Function signature for creating VideoDecoder.
using CreateVDFunc = std::unique_ptr<VideoDecoder> (*)(
scoped_refptr<base::SequencedTaskRunner>,
scoped_refptr<base::SequencedTaskRunner>,
base::RepeatingCallback<DmabufVideoFramePool*()>);
// Get a list of the available functions for creating VideoDeocoder.
static base::queue<CreateVDFunc> GetCreateVDFunctions(
CreateVDFunc current_func);
VideoDecoderPipeline(
scoped_refptr<base::SequencedTaskRunner> client_task_runner,
std::unique_ptr<DmabufVideoFramePool> frame_pool,
std::unique_ptr<VideoFrameConverter> frame_converter);
void Destroy() override;
void DestroyTask();
void CreateAndInitializeVD(base::queue<CreateVDFunc> create_vd_funcs,
VideoDecoderConfig config,
bool low_delay,
CdmContext* cdm_context,
WaitingCB waiting_cb);
void OnInitializeDone(base::queue<CreateVDFunc> create_vd_funcs,
VideoDecoderConfig config,
bool low_delay,
CdmContext* cdm_context,
WaitingCB waiting_cb,
bool success);
void OnDecodeDone(bool eos_buffer, DecodeCB decode_cb, DecodeStatus status);
void OnResetDone();
void OnFrameConverted(scoped_refptr<VideoFrame> frame);
......@@ -93,34 +60,13 @@ class MEDIA_GPU_EXPORT VideoDecoderPipeline : public VideoDecoder {
// Call |client_flush_cb_| with |status| if we need.
void CallFlushCbIfNeeded(DecodeStatus status);
// Get the video frame pool without passing the ownership.
DmabufVideoFramePool* GetVideoFramePool() const;
// The client task runner and its sequence checker. All public methods should
// run on this task runner.
const scoped_refptr<base::SequencedTaskRunner> client_task_runner_;
SEQUENCE_CHECKER(client_sequence_checker_);
// The decoder task runner and its sequence checker. |decoder_| should post
// time-consuming task and call |frame_pool_|'s methods on this task runner.
const scoped_refptr<base::SequencedTaskRunner> decoder_task_runner_;
SEQUENCE_CHECKER(decoder_sequence_checker_);
// The frame pool passed from the client. Destroyed on |decoder_task_runner_|.
std::unique_ptr<DmabufVideoFramePool> frame_pool_;
// The frame converter passed from the client. Destroyed on
// |client_task_runner_|.
std::unique_ptr<VideoFrameConverter> frame_converter_;
// The current video decoder implementation. Valid after initialization is
// successfully done.
std::unique_ptr<VideoDecoder> decoder_;
// The create function of |decoder_|. nullptr iff |decoder_| is nullptr.
CreateVDFunc used_create_vd_func_ = nullptr;
const std::unique_ptr<VideoDecoder> decoder_;
const std::unique_ptr<VideoFrameConverter> frame_converter_;
// Callback from the client. These callback are called on
// |client_task_runner_|.
InitCB init_cb_;
OutputCB client_output_cb_;
DecodeCB client_flush_cb_;
base::OnceClosure client_reset_cb_;
......@@ -128,9 +74,9 @@ class MEDIA_GPU_EXPORT VideoDecoderPipeline : public VideoDecoder {
// Set to true when any unexpected error occurs.
bool has_error_ = false;
// The weak pointer of this, bound to |client_task_runner_|.
base::WeakPtr<VideoDecoderPipeline> weak_this_;
base::WeakPtrFactory<VideoDecoderPipeline> weak_this_factory_{this};
SEQUENCE_CHECKER(sequence_checker_);
base::WeakPtrFactory<VideoDecoderPipeline> weak_this_factory_;
};
} // namespace media
......
......@@ -71,10 +71,6 @@ source_set("v4l2") {
configs += [ "//third_party/libyuv:libyuv_config" ]
public_deps = [
"//ui/gl",
]
deps = [
"//base",
"//gpu/ipc/common",
......
......@@ -128,10 +128,9 @@ struct V4L2SliceVideoDecoder::OutputRequest {
// static
std::unique_ptr<VideoDecoder> V4L2SliceVideoDecoder::Create(
scoped_refptr<base::SequencedTaskRunner> client_task_runner,
scoped_refptr<base::SequencedTaskRunner> decoder_task_runner,
GetFramePoolCB get_pool_cb) {
std::unique_ptr<DmabufVideoFramePool> frame_pool) {
DCHECK(client_task_runner->RunsTasksInCurrentSequence());
DCHECK(get_pool_cb);
DCHECK(frame_pool);
scoped_refptr<V4L2Device> device = V4L2Device::Create();
if (!device) {
......@@ -140,8 +139,7 @@ std::unique_ptr<VideoDecoder> V4L2SliceVideoDecoder::Create(
}
return base::WrapUnique<VideoDecoder>(new V4L2SliceVideoDecoder(
std::move(client_task_runner), std::move(decoder_task_runner),
std::move(device), std::move(get_pool_cb)));
std::move(client_task_runner), std::move(device), std::move(frame_pool)));
}
// static
......@@ -158,19 +156,22 @@ SupportedVideoDecoderConfigs V4L2SliceVideoDecoder::GetSupportedConfigs() {
V4L2SliceVideoDecoder::V4L2SliceVideoDecoder(
scoped_refptr<base::SequencedTaskRunner> client_task_runner,
scoped_refptr<base::SequencedTaskRunner> decoder_task_runner,
scoped_refptr<V4L2Device> device,
GetFramePoolCB get_pool_cb)
std::unique_ptr<DmabufVideoFramePool> frame_pool)
: device_(std::move(device)),
get_pool_cb_(std::move(get_pool_cb)),
frame_pool_(std::move(frame_pool)),
client_task_runner_(std::move(client_task_runner)),
decoder_task_runner_(std::move(decoder_task_runner)),
decoder_task_runner_(base::CreateSequencedTaskRunner(
{base::ThreadPool(), base::WithBaseSyncPrimitives(),
base::TaskPriority::USER_VISIBLE})),
device_poll_thread_("V4L2SliceVideoDecoderDevicePollThread"),
weak_this_factory_(this) {
DETACH_FROM_SEQUENCE(client_sequence_checker_);
DETACH_FROM_SEQUENCE(decoder_sequence_checker_);
VLOGF(2);
weak_this_ = weak_this_factory_.GetWeakPtr();
frame_pool_->set_parent_task_runner(decoder_task_runner_);
}
V4L2SliceVideoDecoder::~V4L2SliceVideoDecoder() {
......@@ -244,7 +245,6 @@ void V4L2SliceVideoDecoder::DestroyTask() {
DCHECK(surfaces_at_device_.empty());
weak_this_factory_.InvalidateWeakPtrs();
delete this;
VLOGF(2) << "Destroyed";
}
......@@ -318,9 +318,6 @@ void V4L2SliceVideoDecoder::InitializeTask(const VideoDecoderConfig& config,
SetState(State::kUninitialized);
}
// Setup frame pool.
frame_pool_ = get_pool_cb_.Run();
// Open V4L2 device.
VideoCodecProfile profile = config.profile();
uint32_t input_format_fourcc =
......
......@@ -38,15 +38,12 @@ class V4L2DecodeSurface;
class MEDIA_GPU_EXPORT V4L2SliceVideoDecoder : public VideoDecoder,
public V4L2DecodeSurfaceHandler {
public:
using GetFramePoolCB = base::RepeatingCallback<DmabufVideoFramePool*()>;
// Create V4L2SliceVideoDecoder instance. The success of the creation doesn't
// ensure V4L2SliceVideoDecoder is available on the device. It will be
// determined in Initialize().
static std::unique_ptr<VideoDecoder> Create(
scoped_refptr<base::SequencedTaskRunner> client_task_runner,
scoped_refptr<base::SequencedTaskRunner> decoder_task_runner,
GetFramePoolCB get_pool_cb);
std::unique_ptr<DmabufVideoFramePool> frame_pool);
static SupportedVideoDecoderConfigs GetSupportedConfigs();
......@@ -83,9 +80,8 @@ class MEDIA_GPU_EXPORT V4L2SliceVideoDecoder : public VideoDecoder,
V4L2SliceVideoDecoder(
scoped_refptr<base::SequencedTaskRunner> client_task_runner,
scoped_refptr<base::SequencedTaskRunner> decoder_task_runner,
scoped_refptr<V4L2Device> device,
GetFramePoolCB get_pool_cb);
std::unique_ptr<DmabufVideoFramePool> frame_pool);
~V4L2SliceVideoDecoder() override;
void Destroy() override;
......@@ -222,8 +218,7 @@ class MEDIA_GPU_EXPORT V4L2SliceVideoDecoder : public VideoDecoder,
// V4L2 device in use.
scoped_refptr<V4L2Device> device_;
// VideoFrame manager used to allocate and recycle video frame.
GetFramePoolCB get_pool_cb_;
DmabufVideoFramePool* frame_pool_ = nullptr;
std::unique_ptr<DmabufVideoFramePool> frame_pool_;
// Video decoder used to parse stream headers by software.
std::unique_ptr<AcceleratedVideoDecoder> avd_;
......
......@@ -68,11 +68,9 @@ VaapiVideoDecoder::DecodeTask::DecodeTask(DecodeTask&&) = default;
// static
std::unique_ptr<VideoDecoder> VaapiVideoDecoder::Create(
scoped_refptr<base::SequencedTaskRunner> client_task_runner,
scoped_refptr<base::SequencedTaskRunner> decoder_task_runner,
GetFramePoolCB get_pool_cb) {
std::unique_ptr<DmabufVideoFramePool> frame_pool) {
return base::WrapUnique<VideoDecoder>(new VaapiVideoDecoder(
std::move(client_task_runner), std::move(decoder_task_runner),
std::move(get_pool_cb)));
std::move(client_task_runner), std::move(frame_pool)));
}
// static
......@@ -83,11 +81,10 @@ SupportedVideoDecoderConfigs VaapiVideoDecoder::GetSupportedConfigs() {
VaapiVideoDecoder::VaapiVideoDecoder(
scoped_refptr<base::SequencedTaskRunner> client_task_runner,
scoped_refptr<base::SequencedTaskRunner> decoder_task_runner,
GetFramePoolCB get_pool_cb)
: get_pool_cb_(std::move(get_pool_cb)),
std::unique_ptr<DmabufVideoFramePool> frame_pool)
: frame_pool_(std::move(frame_pool)),
client_task_runner_(std::move(client_task_runner)),
decoder_task_runner_(std::move(decoder_task_runner)),
decoder_thread_("VaapiDecoderThread"),
weak_this_factory_(this) {
DETACH_FROM_SEQUENCE(decoder_sequence_checker_);
VLOGF(2);
......@@ -152,7 +149,17 @@ void VaapiVideoDecoder::Initialize(const VideoDecoderConfig& config,
return;
}
decoder_task_runner_->PostTask(
if (!decoder_thread_.IsRunning() && !decoder_thread_.Start()) {
std::move(init_cb).Run(false);
return;
}
if (!decoder_thread_task_runner_) {
decoder_thread_task_runner_ = decoder_thread_.task_runner();
frame_pool_->set_parent_task_runner(decoder_thread_task_runner_);
}
decoder_thread_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(&VaapiVideoDecoder::InitializeTask, weak_this_, config,
std::move(init_cb), std::move(output_cb)));
......@@ -220,9 +227,6 @@ void VaapiVideoDecoder::InitializeTask(const VideoDecoderConfig& config,
}
needs_bitstream_conversion_ = (config.codec() == kCodecH264);
// Get and initialize the frame pool.
frame_pool_ = get_pool_cb_.Run();
visible_rect_ = config.visible_rect();
pixel_aspect_ratio_ = config.GetPixelAspectRatio();
profile_ = profile;
......@@ -239,8 +243,14 @@ void VaapiVideoDecoder::Destroy() {
DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
VLOGF(2);
decoder_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&VaapiVideoDecoder::DestroyTask, weak_this_));
if (decoder_thread_task_runner_) {
decoder_thread_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&VaapiVideoDecoder::DestroyTask, weak_this_));
decoder_thread_.Stop();
}
delete this;
VLOGF(2) << "Destroying VAAPI VD done";
}
void VaapiVideoDecoder::DestroyTask() {
......@@ -255,17 +265,18 @@ void VaapiVideoDecoder::DestroyTask() {
decoder_ = nullptr;
}
weak_this_factory_.InvalidateWeakPtrs();
// Drop all video frame references. This will cause the frames to be
// destroyed once the decoder's client is done using them.
frame_pool_ = nullptr;
delete this;
VLOGF(2) << "Destroying VAAPI VD done";
weak_this_factory_.InvalidateWeakPtrs();
}
void VaapiVideoDecoder::Decode(scoped_refptr<DecoderBuffer> buffer,
DecodeCB decode_cb) {
DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
decoder_task_runner_->PostTask(
decoder_thread_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&VaapiVideoDecoder::QueueDecodeTask, weak_this_,
std::move(buffer), std::move(decode_cb)));
}
......@@ -313,7 +324,7 @@ void VaapiVideoDecoder::ScheduleNextDecodeTask() {
*current_decode_task_->buffer_);
}
decoder_task_runner_->PostTask(
decoder_thread_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(&VaapiVideoDecoder::HandleDecodeTask, weak_this_));
}
......@@ -530,7 +541,7 @@ void VaapiVideoDecoder::ChangeFrameResolutionTask() {
vaapi_wrapper_->CreateContext(pic_size);
// Retry the current decode task.
decoder_task_runner_->PostTask(
decoder_thread_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(&VaapiVideoDecoder::HandleDecodeTask, weak_this_));
}
......@@ -559,7 +570,7 @@ void VaapiVideoDecoder::NotifyFrameAvailableTask() {
if (state_ == State::kWaitingForOutput) {
DCHECK(current_decode_task_);
SetState(State::kDecoding);
decoder_task_runner_->PostTask(
decoder_thread_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(&VaapiVideoDecoder::HandleDecodeTask, weak_this_));
}
......@@ -599,7 +610,7 @@ void VaapiVideoDecoder::Reset(base::OnceClosure reset_cb) {
DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
DVLOGF(2);
decoder_task_runner_->PostTask(
decoder_thread_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&VaapiVideoDecoder::ResetTask, weak_this_,
std::move(reset_cb)));
}
......@@ -621,7 +632,7 @@ void VaapiVideoDecoder::ResetTask(base::OnceClosure reset_cb) {
SetState(State::kResetting);
// Wait until any pending decode task has been aborted.
decoder_task_runner_->PostTask(
decoder_thread_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&VaapiVideoDecoder::ResetDoneTask, weak_this_,
std::move(reset_cb)));
}
......
......@@ -39,12 +39,9 @@ class VASurface;
class VaapiVideoDecoder : public media::VideoDecoder,
public DecodeSurfaceHandler<VASurface> {
public:
using GetFramePoolCB = base::RepeatingCallback<DmabufVideoFramePool*()>;
static std::unique_ptr<VideoDecoder> Create(
scoped_refptr<base::SequencedTaskRunner> client_task_runner,
scoped_refptr<base::SequencedTaskRunner> decoder_task_runner,
GetFramePoolCB get_pool);
std::unique_ptr<DmabufVideoFramePool> frame_pool);
static SupportedVideoDecoderConfigs GetSupportedConfigs();
......@@ -94,10 +91,8 @@ class VaapiVideoDecoder : public media::VideoDecoder,
kError, // decoder encountered an error.
};
VaapiVideoDecoder(
scoped_refptr<base::SequencedTaskRunner> client_task_runner,
scoped_refptr<base::SequencedTaskRunner> decoder_task_runner,
GetFramePoolCB get_pool);
VaapiVideoDecoder(scoped_refptr<base::SequencedTaskRunner> client_task_runner,
std::unique_ptr<DmabufVideoFramePool> frame_pool);
~VaapiVideoDecoder() override;
// Destroy the VAAPIVideoDecoder, aborts pending decode requests and blocks
......@@ -176,8 +171,7 @@ class VaapiVideoDecoder : public media::VideoDecoder,
double pixel_aspect_ratio_ = 0.0;
// Video frame pool used to allocate and recycle video frames.
GetFramePoolCB get_pool_cb_;
DmabufVideoFramePool* frame_pool_ = nullptr;
std::unique_ptr<DmabufVideoFramePool> frame_pool_;
// The mapping between buffer id and the timestamp.
std::map<int32_t, base::TimeDelta> buffer_id_to_timestamp_;
......@@ -197,7 +191,8 @@ class VaapiVideoDecoder : public media::VideoDecoder,
scoped_refptr<VaapiWrapper> vaapi_wrapper_;
const scoped_refptr<base::SequencedTaskRunner> client_task_runner_;
const scoped_refptr<base::SequencedTaskRunner> decoder_task_runner_;
base::Thread decoder_thread_;
scoped_refptr<base::SingleThreadTaskRunner> decoder_thread_task_runner_;
SEQUENCE_CHECKER(client_sequence_checker_);
SEQUENCE_CHECKER(decoder_sequence_checker_);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment