Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1241)

Unified Diff: webkit/media/android/webmediaplayer_android.cc

Issue 13688004: Location/size change notification when external rendering is enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase & added a missing ifdef guard Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/media/android/webmediaplayer_android.h ('k') | webkit/media/android/webmediaplayer_impl_android.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/media/android/webmediaplayer_android.cc
diff --git a/webkit/media/android/webmediaplayer_android.cc b/webkit/media/android/webmediaplayer_android.cc
index 7c524729cda9f3707b004c7ab2bccdcd55676101..7536a6f35d11787f0f980172bed3b2f4bb3eb6e2 100644
--- a/webkit/media/android/webmediaplayer_android.cc
+++ b/webkit/media/android/webmediaplayer_android.cc
@@ -94,10 +94,12 @@ void WebMediaPlayerAndroid::cancelLoad() {
}
void WebMediaPlayerAndroid::play() {
+#if defined(GOOGLE_TV)
if (hasVideo() && needs_external_surface_) {
DCHECK(!needs_establish_peer_);
RequestExternalSurface();
}
+#endif
if (hasVideo() && needs_establish_peer_)
EstablishSurfaceTexturePeer();
@@ -385,6 +387,7 @@ void WebMediaPlayerAndroid::OnVideoSizeChanged(int width, int height) {
if (natural_size_.width == width && natural_size_.height == height)
return;
+#if defined(GOOGLE_TV)
static bool has_switch = CommandLine::ForCurrentProcess()->HasSwitch(
switches::kUseExternalVideoSurfaceThresholdInPixels);
static int threshold = 0;
@@ -401,6 +404,7 @@ void WebMediaPlayerAndroid::OnVideoSizeChanged(int width, int height) {
if (!paused())
RequestExternalSurface();
}
+#endif
natural_size_.width = width;
natural_size_.height = height;
@@ -525,4 +529,27 @@ void WebMediaPlayerAndroid::UpdatePlayingState(bool is_playing) {
is_playing_ = is_playing;
}
+#if defined(GOOGLE_TV)
+bool WebMediaPlayerAndroid::RetrieveGeometryChange(gfx::RectF* rect) {
+ if (!video_weblayer_)
+ return false;
+
+ // Compute the geometry of video frame layer.
+ cc::Layer* layer = video_weblayer_->layer();
+ rect->set_size(layer->bounds());
+ while (layer) {
+ rect->Offset(layer->position().OffsetFromOrigin());
+ layer = layer->parent();
+ }
+
+ // Return false when the geometry hasn't been changed from the last time.
+ if (last_computed_rect_ == *rect)
+ return false;
+
+ // Store the changed geometry information when it is actually changed.
+ last_computed_rect_ = *rect;
+ return true;
+}
+#endif
+
} // namespace webkit_media
« no previous file with comments | « webkit/media/android/webmediaplayer_android.h ('k') | webkit/media/android/webmediaplayer_impl_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698