Chromium Code Reviews| Index: media/filters/gpu_video_decoder.cc |
| diff --git a/media/filters/gpu_video_decoder.cc b/media/filters/gpu_video_decoder.cc |
| index 9627a4b156523c5ab3eaa72a881cf893d566d097..b3ea4ed25dc339dab6ba96f4f117cd5d12381569 100644 |
| --- a/media/filters/gpu_video_decoder.cc |
| +++ b/media/filters/gpu_video_decoder.cc |
| @@ -20,6 +20,7 @@ |
| #include "base/threading/thread_task_runner_handle.h" |
| #include "build/build_config.h" |
| #include "gpu/command_buffer/common/mailbox_holder.h" |
| +#include "gpu/command_buffer/service/gpu_switches.h" |
| #include "media/base/bind_to_current_loop.h" |
| #include "media/base/cdm_context.h" |
| #include "media/base/decoder_buffer.h" |
| @@ -85,6 +86,7 @@ GpuVideoDecoder::GpuVideoDecoder(GpuVideoAcceleratorFactories* factories, |
| available_pictures_(0), |
| needs_all_picture_buffers_to_decode_(false), |
| supports_deferred_initialization_(false), |
| + enable_threaded_texture_mailboxes_(false), |
| weak_factory_(this) { |
| DCHECK(factories_); |
| } |
| @@ -172,6 +174,12 @@ void GpuVideoDecoder::Initialize(const VideoDecoderConfig& config, |
| } |
| #endif |
| +#if defined(OS_ANDROID) |
| + enable_threaded_texture_mailboxes_ = |
| + base::CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kEnableThreadedTextureMailboxes); |
|
boliu
2016/06/09 15:37:15
you can't assume gpu switches are present in the r
|
| +#endif |
| + |
| bool previously_initialized = config_.IsValidConfig(); |
| DVLOG(1) << (previously_initialized ? "Reinitializing" : "Initializing") |
| << "GVD with config: " << config.AsHumanReadableString(); |
| @@ -588,6 +596,13 @@ void GpuVideoDecoder::PictureReady(const media::Picture& picture) { |
| #if defined(OS_MACOSX) || defined(OS_WIN) |
| frame->metadata()->SetBoolean(VideoFrameMetadata::DECODER_OWNS_FRAME, true); |
| #endif |
| + |
| +#if defined(OS_ANDROID) |
| + // For WebView. See http://crbug.com/582170. |
| + if (enable_threaded_texture_mailboxes_) |
| + frame->metadata()->SetBoolean(VideoFrameMetadata::COPY_REQUIRED, true); |
| +#endif |
| + |
| CHECK_GT(available_pictures_, 0); |
| --available_pictures_; |