Commit 104ea49e authored by David Staessens's avatar David Staessens Committed by Commit Bot

media/gpu/chromeos: Pass medialog to ChromeOS video decoder.

This CL hooks up everything required to pass the medialog object to
the ChromeOS video decoder. In the future this can be used to provide
move detailed information about the ChromeOS video decoders to
chrome://media-internals.

TEST=./video_decode_accelerator_tests --use_vd on nocturne

BUG=b:158716673

Change-Id: I52775eb85675a9d9d91d6c3d52f6a44ab7386d6e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1895015Reviewed-by: default avatarDan Sanders <sandersd@chromium.org>
Reviewed-by: default avatarChih-Yu Huang <akahuang@chromium.org>
Commit-Queue: David Staessens <dstaessens@chromium.org>
Cr-Commit-Position: refs/heads/master@{#781593}
parent f309021a
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <utility> #include <utility>
#include "base/sequenced_task_runner.h" #include "base/sequenced_task_runner.h"
#include "media/base/media_log.h"
#include "media/base/video_decoder.h" #include "media/base/video_decoder.h"
#include "media/gpu/buildflags.h" #include "media/gpu/buildflags.h"
#include "media/gpu/chromeos/mailbox_video_frame_converter.h" #include "media/gpu/chromeos/mailbox_video_frame_converter.h"
...@@ -73,10 +74,12 @@ ChromeosVideoDecoderFactory::GetSupportedConfigs() { ...@@ -73,10 +74,12 @@ ChromeosVideoDecoderFactory::GetSupportedConfigs() {
std::unique_ptr<VideoDecoder> ChromeosVideoDecoderFactory::Create( std::unique_ptr<VideoDecoder> ChromeosVideoDecoderFactory::Create(
scoped_refptr<base::SequencedTaskRunner> client_task_runner, scoped_refptr<base::SequencedTaskRunner> client_task_runner,
std::unique_ptr<DmabufVideoFramePool> frame_pool, std::unique_ptr<DmabufVideoFramePool> frame_pool,
std::unique_ptr<VideoFrameConverter> frame_converter) { std::unique_ptr<VideoFrameConverter> frame_converter,
std::unique_ptr<MediaLog> media_log) {
return VideoDecoderPipeline::Create( return VideoDecoderPipeline::Create(
std::move(client_task_runner), std::move(frame_pool), std::move(client_task_runner), std::move(frame_pool),
std::move(frame_converter), base::BindRepeating(&GetCreateVDFunctions)); std::move(frame_converter), std::move(media_log),
base::BindRepeating(&GetCreateVDFunctions));
} }
} // namespace media } // namespace media
...@@ -18,6 +18,7 @@ class SequencedTaskRunner; ...@@ -18,6 +18,7 @@ class SequencedTaskRunner;
namespace media { namespace media {
class DmabufVideoFramePool; class DmabufVideoFramePool;
class MediaLog;
class VideoDecoder; class VideoDecoder;
class VideoFrameConverter; class VideoFrameConverter;
...@@ -30,7 +31,8 @@ class MEDIA_GPU_EXPORT ChromeosVideoDecoderFactory { ...@@ -30,7 +31,8 @@ class MEDIA_GPU_EXPORT ChromeosVideoDecoderFactory {
static std::unique_ptr<VideoDecoder> Create( static std::unique_ptr<VideoDecoder> Create(
scoped_refptr<base::SequencedTaskRunner> client_task_runner, scoped_refptr<base::SequencedTaskRunner> client_task_runner,
std::unique_ptr<DmabufVideoFramePool> frame_pool, std::unique_ptr<DmabufVideoFramePool> frame_pool,
std::unique_ptr<VideoFrameConverter> frame_converter); std::unique_ptr<VideoFrameConverter> frame_converter,
std::unique_ptr<MediaLog> media_log);
}; };
} // namespace media } // namespace media
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/location.h" #include "base/location.h"
#include "base/macros.h" #include "base/macros.h"
#include "media/base/media_util.h"
#include "media/base/video_color_space.h" #include "media/base/video_color_space.h"
#include "media/base/video_decoder_config.h" #include "media/base/video_decoder_config.h"
#include "media/base/video_frame.h" #include "media/base/video_frame.h"
...@@ -136,7 +137,8 @@ bool VdVideoDecodeAccelerator::Initialize(const Config& config, ...@@ -136,7 +137,8 @@ bool VdVideoDecodeAccelerator::Initialize(const Config& config,
std::unique_ptr<VdaVideoFramePool> frame_pool = std::unique_ptr<VdaVideoFramePool> frame_pool =
std::make_unique<VdaVideoFramePool>(weak_this_, client_task_runner_); std::make_unique<VdaVideoFramePool>(weak_this_, client_task_runner_);
vd_ = create_vd_cb_.Run(client_task_runner_, std::move(frame_pool), vd_ = create_vd_cb_.Run(client_task_runner_, std::move(frame_pool),
std::make_unique<VideoFrameConverter>()); std::make_unique<VideoFrameConverter>(),
std::make_unique<NullMediaLog>());
if (!vd_) if (!vd_)
return false; return false;
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
namespace media { namespace media {
class MediaLog;
class VideoFrame; class VideoFrame;
// Implements the VideoDecodeAccelerator backed by a VideoDecoder. // Implements the VideoDecodeAccelerator backed by a VideoDecoder.
...@@ -47,7 +48,8 @@ class MEDIA_GPU_EXPORT VdVideoDecodeAccelerator ...@@ -47,7 +48,8 @@ class MEDIA_GPU_EXPORT VdVideoDecodeAccelerator
base::RepeatingCallback<std::unique_ptr<VideoDecoder>( base::RepeatingCallback<std::unique_ptr<VideoDecoder>(
scoped_refptr<base::SequencedTaskRunner>, scoped_refptr<base::SequencedTaskRunner>,
std::unique_ptr<DmabufVideoFramePool>, std::unique_ptr<DmabufVideoFramePool>,
std::unique_ptr<VideoFrameConverter>)>; std::unique_ptr<VideoFrameConverter>,
std::unique_ptr<MediaLog>)>;
// Create VdVideoDecodeAccelerator instance, and call Initialize(). // Create VdVideoDecodeAccelerator instance, and call Initialize().
// Return nullptr if Initialize() failed. // Return nullptr if Initialize() failed.
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "base/task/thread_pool.h" #include "base/task/thread_pool.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "media/base/limits.h" #include "media/base/limits.h"
#include "media/base/media_log.h"
#include "media/gpu/chromeos/dmabuf_video_frame_pool.h" #include "media/gpu/chromeos/dmabuf_video_frame_pool.h"
#include "media/gpu/chromeos/image_processor.h" #include "media/gpu/chromeos/image_processor.h"
#include "media/gpu/chromeos/image_processor_factory.h" #include "media/gpu/chromeos/image_processor_factory.h"
...@@ -68,6 +69,7 @@ std::unique_ptr<VideoDecoder> VideoDecoderPipeline::Create( ...@@ -68,6 +69,7 @@ std::unique_ptr<VideoDecoder> VideoDecoderPipeline::Create(
scoped_refptr<base::SequencedTaskRunner> client_task_runner, scoped_refptr<base::SequencedTaskRunner> client_task_runner,
std::unique_ptr<DmabufVideoFramePool> frame_pool, std::unique_ptr<DmabufVideoFramePool> frame_pool,
std::unique_ptr<VideoFrameConverter> frame_converter, std::unique_ptr<VideoFrameConverter> frame_converter,
std::unique_ptr<MediaLog> /*media_log*/,
GetCreateVDFunctionsCB get_create_vd_functions_cb) { GetCreateVDFunctionsCB get_create_vd_functions_cb) {
if (!client_task_runner || !frame_pool || !frame_converter) { if (!client_task_runner || !frame_pool || !frame_converter) {
VLOGF(1) << "One of arguments is nullptr."; VLOGF(1) << "One of arguments is nullptr.";
......
...@@ -27,6 +27,7 @@ class SequencedTaskRunner; ...@@ -27,6 +27,7 @@ class SequencedTaskRunner;
namespace media { namespace media {
class DmabufVideoFramePool; class DmabufVideoFramePool;
class MediaLog;
// An interface that defines methods to operate on video decoder components // An interface that defines methods to operate on video decoder components
// inside the VideoDecoderPipeline. The interface is similar to // inside the VideoDecoderPipeline. The interface is similar to
...@@ -137,6 +138,7 @@ class MEDIA_GPU_EXPORT VideoDecoderPipeline : public VideoDecoder, ...@@ -137,6 +138,7 @@ class MEDIA_GPU_EXPORT VideoDecoderPipeline : public VideoDecoder,
scoped_refptr<base::SequencedTaskRunner> client_task_runner, scoped_refptr<base::SequencedTaskRunner> client_task_runner,
std::unique_ptr<DmabufVideoFramePool> frame_pool, std::unique_ptr<DmabufVideoFramePool> frame_pool,
std::unique_ptr<VideoFrameConverter> frame_converter, std::unique_ptr<VideoFrameConverter> frame_converter,
std::unique_ptr<MediaLog> media_log,
GetCreateVDFunctionsCB get_create_vd_functions_cb); GetCreateVDFunctionsCB get_create_vd_functions_cb);
~VideoDecoderPipeline() override; ~VideoDecoderPipeline() override;
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "base/task/post_task.h" #include "base/task/post_task.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "media/base/media_log.h"
#include "media/base/video_frame.h" #include "media/base/video_frame.h"
#include "media/base/video_util.h" #include "media/base/video_util.h"
#include "media/base/waiting.h" #include "media/base/waiting.h"
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "media/base/media_util.h"
#include "media/base/waiting.h" #include "media/base/waiting.h"
#include "media/gpu/macros.h" #include "media/gpu/macros.h"
#include "media/gpu/test/video.h" #include "media/gpu/test/video.h"
...@@ -189,7 +190,8 @@ void VideoDecoderClient::CreateDecoderTask(bool* success, ...@@ -189,7 +190,8 @@ void VideoDecoderClient::CreateDecoderTask(bool* success,
base::ThreadTaskRunnerHandle::Get(), base::ThreadTaskRunnerHandle::Get(),
std::make_unique<PlatformVideoFramePool>( std::make_unique<PlatformVideoFramePool>(
gpu_memory_buffer_factory_), gpu_memory_buffer_factory_),
std::make_unique<VideoFrameConverter>()); std::make_unique<VideoFrameConverter>(),
std::make_unique<NullMediaLog>());
} else { } else {
LOG(ERROR) << "VD-based video decoders only support import mode"; LOG(ERROR) << "VD-based video decoders only support import mode";
} }
......
...@@ -268,7 +268,8 @@ std::unique_ptr<VideoDecoder> GpuMojoMediaClient::CreateVideoDecoder( ...@@ -268,7 +268,8 @@ std::unique_ptr<VideoDecoder> GpuMojoMediaClient::CreateVideoDecoder(
command_buffer_id->channel_token, command_buffer_id->channel_token,
command_buffer_id->route_id)); command_buffer_id->route_id));
video_decoder = ChromeosVideoDecoderFactory::Create( video_decoder = ChromeosVideoDecoderFactory::Create(
task_runner, std::move(frame_pool), std::move(frame_converter)); task_runner, std::move(frame_pool), std::move(frame_converter),
media_log->Clone());
} else { } else {
video_decoder = VdaVideoDecoder::Create( video_decoder = VdaVideoDecoder::Create(
task_runner, gpu_task_runner_, media_log->Clone(), task_runner, gpu_task_runner_, media_log->Clone(),
......
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