diff options
author | wonsik@chromium.org <wonsik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-11 04:04:37 +0000 |
---|---|---|
committer | wonsik@chromium.org <wonsik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-11 04:04:37 +0000 |
commit | b969f4fa2d180c35b7be58e9adc38ce67bc39f66 (patch) | |
tree | c7e3b428996ba8efd60e6bffab2003f50e3632e2 /webkit | |
parent | ed95e02da69e469de255362cdb4114fe8e4c0c64 (diff) | |
download | chromium_src-b969f4fa2d180c35b7be58e9adc38ce67bc39f66.zip chromium_src-b969f4fa2d180c35b7be58e9adc38ce67bc39f66.tar.gz chromium_src-b969f4fa2d180c35b7be58e9adc38ce67bc39f66.tar.bz2 |
Modify kUseExternalVideoSurface to have threshold value.
Modify kUseExternalVideoSurface from on-off flag to threshold in
terms of number of pixels per video frame.
BUG=180197
R=sievers@chromium.org,scherkus@chromium.org
Review URL: https://chromiumcodereview.appspot.com/13775009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193562 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/media/android/webmediaplayer_android.cc | 25 | ||||
-rw-r--r-- | webkit/media/media_switches.cc | 9 | ||||
-rw-r--r-- | webkit/media/media_switches.h | 2 |
3 files changed, 26 insertions, 10 deletions
diff --git a/webkit/media/android/webmediaplayer_android.cc b/webkit/media/android/webmediaplayer_android.cc index fcddda0..7c52472 100644 --- a/webkit/media/android/webmediaplayer_android.cc +++ b/webkit/media/android/webmediaplayer_android.cc @@ -7,6 +7,7 @@ #include "base/command_line.h" #include "base/files/file_path.h" #include "base/logging.h" +#include "base/strings/string_number_conversions.h" #include "cc/layers/video_layer.h" #include "media/base/android/media_player_bridge.h" #include "media/base/video_frame.h" @@ -52,12 +53,7 @@ WebMediaPlayerAndroid::WebMediaPlayerAndroid( if (manager_) player_id_ = manager_->RegisterMediaPlayer(this); - if (CommandLine::ForCurrentProcess()->HasSwitch( - switches::kUseExternalVideoSurface)) { - needs_external_surface_ = true; - SetNeedsEstablishPeer(false); - ReallocateVideoFrame(); - } else if (stream_texture_factory_.get()) { + if (stream_texture_factory_.get()) { stream_texture_proxy_.reset(stream_texture_factory_->CreateProxy()); stream_id_ = stream_texture_factory_->CreateStreamTexture(&texture_id_); ReallocateVideoFrame(); @@ -389,6 +385,23 @@ void WebMediaPlayerAndroid::OnVideoSizeChanged(int width, int height) { if (natural_size_.width == width && natural_size_.height == height) return; + static bool has_switch = CommandLine::ForCurrentProcess()->HasSwitch( + switches::kUseExternalVideoSurfaceThresholdInPixels); + static int threshold = 0; + static bool parsed_arg = + has_switch && + base::StringToInt( + CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + switches::kUseExternalVideoSurfaceThresholdInPixels), + &threshold); + + if (parsed_arg && threshold <= width * height) { + needs_external_surface_ = true; + SetNeedsEstablishPeer(false); + if (!paused()) + RequestExternalSurface(); + } + natural_size_.width = width; natural_size_.height = height; ReallocateVideoFrame(); diff --git a/webkit/media/media_switches.cc b/webkit/media/media_switches.cc index fd06fe3..b208645 100644 --- a/webkit/media/media_switches.cc +++ b/webkit/media/media_switches.cc @@ -7,9 +7,12 @@ namespace switches { #if defined(OS_ANDROID) -// Always use external video surface. Normally, external video surfaces are used -// sparingly. -const char kUseExternalVideoSurface[] = "use-external-video-surface"; +// Use external video surface for video with more than or equal pixels to +// specified value. For example, value of 0 will enable external video surface +// for all videos, and value of 921600 (=1280*720) will enable external video +// surface for 720p video and larger. +const char kUseExternalVideoSurfaceThresholdInPixels[] = + "use-external-video-surface-threshold-in-pixels"; #endif } // namespace switches diff --git a/webkit/media/media_switches.h b/webkit/media/media_switches.h index 2d0b8d1..a6934cfd1 100644 --- a/webkit/media/media_switches.h +++ b/webkit/media/media_switches.h @@ -10,7 +10,7 @@ namespace switches { #if defined(OS_ANDROID) -extern const char kUseExternalVideoSurface[]; +extern const char kUseExternalVideoSurfaceThresholdInPixels[]; #endif } // namespace switches |