diff options
author | liberato <liberato@chromium.org> | 2015-12-16 12:00:16 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-16 20:01:02 +0000 |
commit | 2ac89ad12d6f0c914c673e57299f69e6d2046941 (patch) | |
tree | e075676e999fbe56d44c07f7dc462e3428ce0fe7 | |
parent | bab30384a7d5cf9dfd77f6e9269b6d492e9aa0af (diff) | |
download | chromium_src-2ac89ad12d6f0c914c673e57299f69e6d2046941.zip chromium_src-2ac89ad12d6f0c914c673e57299f69e6d2046941.tar.gz chromium_src-2ac89ad12d6f0c914c673e57299f69e6d2046941.tar.bz2 |
Use AVDA copying strategy unless the unified pipeline flag is set.
Cause AVDA to use the copying strategy unless the right #defines
and runtime flags are provided to enable it. We want to prevent
WebRTC from using the unfinished deferred rendering strategy, unless
the unifed media pipeline runtime flag is present to enable it.
BUG=565561
Review URL: https://codereview.chromium.org/1515993003
Cr-Commit-Position: refs/heads/master@{#365596}
5 files changed, 28 insertions, 18 deletions
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc index 370da12..dfe06a8 100644 --- a/content/browser/gpu/gpu_process_host.cc +++ b/content/browser/gpu/gpu_process_host.cc @@ -107,6 +107,9 @@ static const char* const kSwitchNames[] = { switches::kEnableHeapProfiling, switches::kEnableLogging, switches::kEnableShareGroupAsyncTextureUpload, +#if defined(OS_ANDROID) + switches::kEnableUnifiedMediaPipeline, +#endif #if defined(OS_CHROMEOS) switches::kDisableVaapiAcceleratedVideoEncode, #endif diff --git a/content/common/gpu/media/android_copying_backing_strategy.h b/content/common/gpu/media/android_copying_backing_strategy.h index 15be76d..92f82ff 100644 --- a/content/common/gpu/media/android_copying_backing_strategy.h +++ b/content/common/gpu/media/android_copying_backing_strategy.h @@ -40,11 +40,6 @@ class CONTENT_EXPORT AndroidCopyingBackingStrategy media::VideoCodecBridge*, const AndroidVideoDecodeAccelerator::OutputBufferMap&) override; - static media::VideoDecodeAccelerator::Capabilities::Flags - GetCapabilitiesFlags() { - return media::VideoDecodeAccelerator::Capabilities::NO_FLAGS; - } - private: // Used for copy the texture from surface texture to picture buffers. scoped_ptr<gpu::CopyTextureCHROMIUMResourceManager> copier_; diff --git a/content/common/gpu/media/android_deferred_rendering_backing_strategy.h b/content/common/gpu/media/android_deferred_rendering_backing_strategy.h index b056e13..8219891 100644 --- a/content/common/gpu/media/android_deferred_rendering_backing_strategy.h +++ b/content/common/gpu/media/android_deferred_rendering_backing_strategy.h @@ -47,12 +47,6 @@ class CONTENT_EXPORT AndroidDeferredRenderingBackingStrategy media::VideoCodecBridge*, const AndroidVideoDecodeAccelerator::OutputBufferMap&) override; - static media::VideoDecodeAccelerator::Capabilities::Flags - GetCapabilitiesFlags() { - return media::VideoDecodeAccelerator::Capabilities:: - NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE; - } - private: // Release any codec buffer that is associated with the given picture buffer // back to the codec. It is okay if there is no such buffer. diff --git a/content/common/gpu/media/android_video_decode_accelerator.cc b/content/common/gpu/media/android_video_decode_accelerator.cc index 6b381f3..fa0a03e 100644 --- a/content/common/gpu/media/android_video_decode_accelerator.cc +++ b/content/common/gpu/media/android_video_decode_accelerator.cc @@ -5,6 +5,7 @@ #include "content/common/gpu/media/android_video_decode_accelerator.h" #include "base/bind.h" +#include "base/command_line.h" #include "base/logging.h" #include "base/message_loop/message_loop.h" #include "base/metrics/histogram.h" @@ -16,6 +17,7 @@ #include "gpu/command_buffer/service/gles2_cmd_decoder.h" #include "media/base/bitstream_buffer.h" #include "media/base/limits.h" +#include "media/base/media_switches.h" #include "media/base/timestamp_constants.h" #include "media/base/video_decoder_config.h" #include "media/video/picture.h" @@ -59,10 +61,6 @@ static const media::VideoCodecProfile kSupportedH264Profiles[] = { media::H264PROFILE_STEREOHIGH, media::H264PROFILE_MULTIVIEWHIGH }; - -#define BACKING_STRATEGY AndroidDeferredRenderingBackingStrategy -#else -#define BACKING_STRATEGY AndroidCopyingBackingStrategy #endif // Because MediaCodec is thread-hostile (must be poked on a single thread) and @@ -97,8 +95,12 @@ AndroidVideoDecodeAccelerator::AndroidVideoDecodeAccelerator( state_(NO_ERROR), picturebuffers_requested_(false), gl_decoder_(decoder), - strategy_(new BACKING_STRATEGY()), - weak_this_factory_(this) {} + weak_this_factory_(this) { + if (UseDeferredRenderingStrategy()) + strategy_.reset(new AndroidDeferredRenderingBackingStrategy()); + else + strategy_.reset(new AndroidCopyingBackingStrategy()); +} AndroidVideoDecodeAccelerator::~AndroidVideoDecodeAccelerator() { DCHECK(thread_checker_.CalledOnValidThread()); @@ -645,6 +647,16 @@ void AndroidVideoDecodeAccelerator::NotifyError( } // static +bool AndroidVideoDecodeAccelerator::UseDeferredRenderingStrategy() { +#if defined(ENABLE_MEDIA_PIPELINE_ON_ANDROID) + return base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableUnifiedMediaPipeline); +#endif + + return false; +} + +// static media::VideoDecodeAccelerator::Capabilities AndroidVideoDecodeAccelerator::GetCapabilities() { Capabilities capabilities; @@ -681,7 +693,10 @@ AndroidVideoDecodeAccelerator::GetCapabilities() { } #endif - capabilities.flags = BACKING_STRATEGY::GetCapabilitiesFlags(); + if (UseDeferredRenderingStrategy()) { + capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: + NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE; + } return capabilities; } diff --git a/content/common/gpu/media/android_video_decode_accelerator.h b/content/common/gpu/media/android_video_decode_accelerator.h index e79f0c0..3c80c2d 100644 --- a/content/common/gpu/media/android_video_decode_accelerator.h +++ b/content/common/gpu/media/android_video_decode_accelerator.h @@ -161,6 +161,9 @@ class CONTENT_EXPORT AndroidVideoDecodeAccelerator // Notifies about decoding errors. void NotifyError(media::VideoDecodeAccelerator::Error error); + // Return true if and only if we should use deferred rendering. + static bool UseDeferredRenderingStrategy(); + // Used to DCHECK that we are called on the correct thread. base::ThreadChecker thread_checker_; |