Index: content/renderer/media/android/webmediaplayer_android.cc |
diff --git a/content/renderer/media/android/webmediaplayer_android.cc b/content/renderer/media/android/webmediaplayer_android.cc |
index ee32628622a225bf2bd4cba423f2c0e6782215bc..3ded40afb68a4c2f633380f98474cf544dad4444 100644 |
--- a/content/renderer/media/android/webmediaplayer_android.cc |
+++ b/content/renderer/media/android/webmediaplayer_android.cc |
@@ -663,7 +663,14 @@ void WebMediaPlayerAndroid::OnVideoSizeChanged(int width, int height) { |
natural_size_.width = width; |
natural_size_.height = height; |
ReallocateVideoFrame(); |
- CreateWebLayerIfNeeded(); |
+ |
+ // Lazily allocate compositing layer. |
+ if (!video_weblayer_) { |
+ video_weblayer_.reset( |
+ new webkit::WebLayerImpl(cc::VideoLayer::Create(this))); |
+ client_->setWebLayer(video_weblayer_.get()); |
+ } |
+ |
// TODO(qinmin): This is a hack. We need the media element to stop showing the |
// poster image by forcing it to call setDisplayMode(video). Should move the |
// logic into HTMLMediaElement.cpp. |
@@ -989,13 +996,6 @@ void WebMediaPlayerAndroid::ReallocateVideoFrame() { |
} |
} |
-void WebMediaPlayerAndroid::CreateWebLayerIfNeeded() { |
- if (!hasVideo() || video_weblayer_ || !client_->needsWebLayerForVideo()) |
- return; |
- video_weblayer_.reset(new webkit::WebLayerImpl(cc::VideoLayer::Create(this))); |
- client_->setWebLayer(video_weblayer_.get()); |
-} |
- |
void WebMediaPlayerAndroid::SetVideoFrameProviderClient( |
cc::VideoFrameProvider::Client* client) { |
// This is called from both the main renderer thread and the compositor |