Commit 0e04db34 authored by Frank Liberato's avatar Frank Liberato Committed by Commit Bot

Make D3D11VideoDecoder fall back to VDAVideoDecoder.

To try to reduce time to first frame regressions, this CL makes
D3D11VideoDecoder fall back to VDAVideoDecoder via
FallbacKVideoDecoder.  This prevents a round trip or two between the
GPU and renderer processes.

Bug: 832917
Change-Id: I2b3df44805fd950328beb6db88590718550630d1
Reviewed-on: https://chromium-review.googlesource.com/c/1294810
Commit-Queue: Frank Liberato <liberato@chromium.org>
Reviewed-by: default avatarDan Sanders <sandersd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601789}
parent cc24d905
...@@ -8,10 +8,12 @@ ...@@ -8,10 +8,12 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/feature_list.h" #include "base/feature_list.h"
#include "base/memory/ptr_util.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "gpu/ipc/service/gpu_channel.h" #include "gpu/ipc/service/gpu_channel.h"
#include "media/base/audio_decoder.h" #include "media/base/audio_decoder.h"
#include "media/base/cdm_factory.h" #include "media/base/cdm_factory.h"
#include "media/base/fallback_video_decoder.h"
#include "media/base/media_switches.h" #include "media/base/media_switches.h"
#include "media/base/video_decoder.h" #include "media/base/video_decoder.h"
#include "media/gpu/buildflags.h" #include "media/gpu/buildflags.h"
...@@ -147,22 +149,26 @@ std::unique_ptr<VideoDecoder> GpuMojoMediaClient::CreateVideoDecoder( ...@@ -147,22 +149,26 @@ std::unique_ptr<VideoDecoder> GpuMojoMediaClient::CreateVideoDecoder(
std::make_unique<VideoFrameFactoryImpl>(gpu_task_runner_, std::make_unique<VideoFrameFactoryImpl>(gpu_task_runner_,
std::move(get_stub_cb))); std::move(get_stub_cb)));
#elif defined(OS_CHROMEOS) || defined(OS_MACOSX) || defined(OS_WIN) #elif defined(OS_CHROMEOS) || defined(OS_MACOSX) || defined(OS_WIN)
#if defined(OS_WIN) std::unique_ptr<VideoDecoder> vda_video_decoder = VdaVideoDecoder::Create(
if (base::FeatureList::IsEnabled(kD3D11VideoDecoder)) {
return D3D11VideoDecoder::Create(
gpu_task_runner_, media_log->Clone(), gpu_preferences_,
gpu_workarounds_,
base::BindRepeating(&GetCommandBufferStub, media_gpu_channel_manager_,
command_buffer_id->channel_token,
command_buffer_id->route_id));
}
#endif // defined(OS_WIN)
return VdaVideoDecoder::Create(
task_runner, gpu_task_runner_, media_log->Clone(), target_color_space, task_runner, gpu_task_runner_, media_log->Clone(), target_color_space,
gpu_preferences_, gpu_workarounds_, gpu_preferences_, gpu_workarounds_,
base::BindRepeating(&GetCommandBufferStub, media_gpu_channel_manager_, base::BindRepeating(&GetCommandBufferStub, media_gpu_channel_manager_,
command_buffer_id->channel_token, command_buffer_id->channel_token,
command_buffer_id->route_id)); command_buffer_id->route_id));
#if defined(OS_WIN)
if (base::FeatureList::IsEnabled(kD3D11VideoDecoder)) {
std::unique_ptr<VideoDecoder> d3d11_video_decoder =
D3D11VideoDecoder::Create(
gpu_task_runner_, media_log->Clone(), gpu_preferences_,
gpu_workarounds_,
base::BindRepeating(
&GetCommandBufferStub, media_gpu_channel_manager_,
command_buffer_id->channel_token, command_buffer_id->route_id));
return base::WrapUnique<VideoDecoder>(new FallbackVideoDecoder(
std::move(d3d11_video_decoder), std::move(vda_video_decoder)));
}
#endif // defined(OS_WIN)
return vda_video_decoder;
#else #else
return nullptr; return nullptr;
#endif // defined(OS_ANDROID) #endif // defined(OS_ANDROID)
......
...@@ -98,16 +98,9 @@ void DefaultDecoderFactory::CreateVideoDecoders( ...@@ -98,16 +98,9 @@ void DefaultDecoderFactory::CreateVideoDecoders(
task_runner, gpu_factories, media_log, request_overlay_info_cb, task_runner, gpu_factories, media_log, request_overlay_info_cb,
target_color_space, video_decoders); target_color_space, video_decoders);
} }
// MojoVideoDecoder replaces any VDA for this platform when it's enabled. // MojoVideoDecoder replaces any VDA for this platform when it's enabled.
bool enable_vda = !base::FeatureList::IsEnabled(media::kMojoVideoDecoder); if (!base::FeatureList::IsEnabled(media::kMojoVideoDecoder)) {
#if defined(OS_WIN)
// D3D11VideoDecoder doesn't support as many cases as dxva yet, so don't
// turn off hw decode just because it's enabled.
// TODO(crbug.com/832171): Move the check for the most common unsupported
// cases for D3D11VideoDecoder to the renderer, to save an IPC hop.
enable_vda = true;
#endif
if (enable_vda) {
video_decoders->push_back(std::make_unique<GpuVideoDecoder>( video_decoders->push_back(std::make_unique<GpuVideoDecoder>(
gpu_factories, request_overlay_info_cb, target_color_space, gpu_factories, request_overlay_info_cb, target_color_space,
media_log)); media_log));
......
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