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

Side by Side Diff: content/renderer/media/android/webmediaplayer_android.cc

Issue 18081003: Fix fullscreen video bugs on TV (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 5 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 unified diff | Download patch
« no previous file with comments | « content/browser/android/media_player_manager_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/android/webmediaplayer_android.h" 5 #include "content/renderer/media/android/webmediaplayer_android.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 has_media_info_ = true; 285 has_media_info_ = true;
286 if (has_media_metadata_ && 286 if (has_media_metadata_ &&
287 ready_state_ != WebMediaPlayer::ReadyStateHaveEnoughData) { 287 ready_state_ != WebMediaPlayer::ReadyStateHaveEnoughData) {
288 UpdateReadyState(WebMediaPlayer::ReadyStateHaveMetadata); 288 UpdateReadyState(WebMediaPlayer::ReadyStateHaveMetadata);
289 UpdateReadyState(WebMediaPlayer::ReadyStateHaveEnoughData); 289 UpdateReadyState(WebMediaPlayer::ReadyStateHaveEnoughData);
290 } 290 }
291 } 291 }
292 292
293 void WebMediaPlayerAndroid::play() { 293 void WebMediaPlayerAndroid::play() {
294 #if defined(GOOGLE_TV) 294 #if defined(GOOGLE_TV)
295 if (hasVideo() && needs_external_surface_) { 295 if (hasVideo() && needs_external_surface_ &&
296 !manager_->IsInFullscreen(frame_)) {
296 DCHECK(!needs_establish_peer_); 297 DCHECK(!needs_establish_peer_);
297 proxy_->RequestExternalSurface(player_id_, last_computed_rect_); 298 proxy_->RequestExternalSurface(player_id_, last_computed_rect_);
298 } 299 }
299 if (audio_renderer_ && paused()) 300 if (audio_renderer_ && paused())
300 audio_renderer_->Play(); 301 audio_renderer_->Play();
301 #endif 302 #endif
302 if (hasVideo() && needs_establish_peer_) 303 if (hasVideo() && needs_establish_peer_)
303 EstablishSurfaceTexturePeer(); 304 EstablishSurfaceTexturePeer();
304 305
305 if (paused()) 306 if (paused())
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 has_size_info_ = true; 618 has_size_info_ = true;
618 if (natural_size_.width == width && natural_size_.height == height) 619 if (natural_size_.width == width && natural_size_.height == height)
619 return; 620 return;
620 621
621 #if defined(GOOGLE_TV) 622 #if defined(GOOGLE_TV)
622 if ((external_surface_threshold_ >= 0 && 623 if ((external_surface_threshold_ >= 0 &&
623 external_surface_threshold_ <= width * height) || 624 external_surface_threshold_ <= width * height) ||
624 // Use H/W surface for MSE as the content is protected. 625 // Use H/W surface for MSE as the content is protected.
625 media_source_delegate_) { 626 media_source_delegate_) {
626 needs_external_surface_ = true; 627 needs_external_surface_ = true;
627 if (!paused()) 628 if (!paused() && !manager_->IsInFullscreen(frame_))
628 proxy_->RequestExternalSurface(player_id_, last_computed_rect_); 629 proxy_->RequestExternalSurface(player_id_, last_computed_rect_);
629 } else if (stream_texture_factory_ && !stream_texture_proxy_) { 630 } else if (stream_texture_factory_ && !stream_texture_proxy_) {
630 // Do deferred stream texture creation finally. 631 // Do deferred stream texture creation finally.
631 if (paused()) { 632 if (paused()) {
632 stream_id_ = stream_texture_factory_->CreateStreamTexture( 633 stream_id_ = stream_texture_factory_->CreateStreamTexture(
633 kGLTextureExternalOES, 634 kGLTextureExternalOES,
634 &texture_id_, 635 &texture_id_,
635 &texture_mailbox_, 636 &texture_mailbox_,
636 &texture_mailbox_sync_point_); 637 &texture_mailbox_sync_point_);
637 SetNeedsEstablishPeer(true); 638 SetNeedsEstablishPeer(true);
(...skipping 22 matching lines...) Expand all
660 661
661 void WebMediaPlayerAndroid::OnDidExitFullscreen() { 662 void WebMediaPlayerAndroid::OnDidExitFullscreen() {
662 // |needs_external_surface_| is always false on non-TV devices. 663 // |needs_external_surface_| is always false on non-TV devices.
663 if (!needs_external_surface_) 664 if (!needs_external_surface_)
664 SetNeedsEstablishPeer(true); 665 SetNeedsEstablishPeer(true);
665 // We had the fullscreen surface connected to Android MediaPlayer, 666 // We had the fullscreen surface connected to Android MediaPlayer,
666 // so reconnect our surface texture for embedded playback. 667 // so reconnect our surface texture for embedded playback.
667 if (!paused() && needs_establish_peer_) 668 if (!paused() && needs_establish_peer_)
668 EstablishSurfaceTexturePeer(); 669 EstablishSurfaceTexturePeer();
669 670
671 #if defined(GOOGLE_TV)
672 if (!paused() && needs_external_surface_)
673 proxy_->RequestExternalSurface(player_id_, last_computed_rect_);
674 #endif
675
670 frame_->view()->willExitFullScreen(); 676 frame_->view()->willExitFullScreen();
671 frame_->view()->didExitFullScreen(); 677 frame_->view()->didExitFullScreen();
672 manager_->DidExitFullscreen(); 678 manager_->DidExitFullscreen();
673 client_->repaint(); 679 client_->repaint();
674 } 680 }
675 681
676 void WebMediaPlayerAndroid::OnMediaPlayerPlay() { 682 void WebMediaPlayerAndroid::OnMediaPlayerPlay() {
677 UpdatePlayingState(true); 683 UpdatePlayingState(true);
678 client_->playbackStateChanged(); 684 client_->playbackStateChanged();
679 } 685 }
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 1163
1158 void WebMediaPlayerAndroid::exitFullscreen() { 1164 void WebMediaPlayerAndroid::exitFullscreen() {
1159 proxy_->ExitFullscreen(player_id_); 1165 proxy_->ExitFullscreen(player_id_);
1160 } 1166 }
1161 1167
1162 bool WebMediaPlayerAndroid::canEnterFullscreen() const { 1168 bool WebMediaPlayerAndroid::canEnterFullscreen() const {
1163 return manager_->CanEnterFullscreen(frame_); 1169 return manager_->CanEnterFullscreen(frame_);
1164 } 1170 }
1165 1171
1166 } // namespace content 1172 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/media_player_manager_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698