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

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

Issue 2084223002: Make the video layer visibility configurable in OverlayFullscreenVideo mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 10
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 TryCreateStreamTextureProxyIfNeeded(); 1040 TryCreateStreamTextureProxyIfNeeded();
1041 EstablishSurfaceTexturePeer(); 1041 EstablishSurfaceTexturePeer();
1042 suppress_deleting_texture_ = true; 1042 suppress_deleting_texture_ = true;
1043 } 1043 }
1044 1044
1045 #if defined(VIDEO_HOLE) 1045 #if defined(VIDEO_HOLE)
1046 if (!paused() && needs_external_surface_) 1046 if (!paused() && needs_external_surface_)
1047 player_manager_->RequestExternalSurface(player_id_, last_computed_rect_); 1047 player_manager_->RequestExternalSurface(player_id_, last_computed_rect_);
1048 #endif // defined(VIDEO_HOLE) 1048 #endif // defined(VIDEO_HOLE)
1049 is_fullscreen_ = false; 1049 is_fullscreen_ = false;
1050 ReallocateVideoFrame();
1051 client_->repaint(); 1050 client_->repaint();
1052 } 1051 }
1053 1052
1054 void WebMediaPlayerAndroid::OnMediaPlayerPlay() { 1053 void WebMediaPlayerAndroid::OnMediaPlayerPlay() {
1055 // The MediaPlayer might request the video to be played after it lost its 1054 // The MediaPlayer might request the video to be played after it lost its
1056 // stream texture proxy or the peer connection, for example, if the video was 1055 // stream texture proxy or the peer connection, for example, if the video was
1057 // paused while fullscreen then fullscreen state was left. 1056 // paused while fullscreen then fullscreen state was left.
1058 TryCreateStreamTextureProxyIfNeeded(); 1057 TryCreateStreamTextureProxyIfNeeded();
1059 if (needs_establish_peer_) 1058 if (needs_establish_peer_)
1060 EstablishSurfaceTexturePeer(); 1059 EstablishSurfaceTexturePeer();
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 canvas_size, 1200 canvas_size,
1202 base::Bind(&StreamTextureFactory::ContextGL, 1201 base::Bind(&StreamTextureFactory::ContextGL,
1203 stream_texture_factory_))); 1202 stream_texture_factory_)));
1204 if (!new_frame) 1203 if (!new_frame)
1205 return; 1204 return;
1206 SetCurrentFrameInternal(new_frame); 1205 SetCurrentFrameInternal(new_frame);
1207 } 1206 }
1208 1207
1209 void WebMediaPlayerAndroid::ReallocateVideoFrame() { 1208 void WebMediaPlayerAndroid::ReallocateVideoFrame() {
1210 DCHECK(main_thread_checker_.CalledOnValidThread()); 1209 DCHECK(main_thread_checker_.CalledOnValidThread());
1211
1212 if (is_fullscreen_) return;
1213 if (needs_external_surface_) { 1210 if (needs_external_surface_) {
1214 // VideoFrame::CreateHoleFrame is only defined under VIDEO_HOLE. 1211 // VideoFrame::CreateHoleFrame is only defined under VIDEO_HOLE.
1215 #if defined(VIDEO_HOLE) 1212 #if defined(VIDEO_HOLE)
1216 if (!natural_size_.isEmpty()) { 1213 if (!natural_size_.isEmpty()) {
1217 // Now we finally know that "stream texture" and "video frame" won't 1214 // Now we finally know that "stream texture" and "video frame" won't
1218 // be needed. EME uses "external surface" and "video hole" instead. 1215 // be needed. EME uses "external surface" and "video hole" instead.
1219 RemoveSurfaceTextureAndProxy(); 1216 RemoveSurfaceTextureAndProxy();
1220 scoped_refptr<VideoFrame> new_frame = 1217 scoped_refptr<VideoFrame> new_frame =
1221 VideoFrame::CreateHoleFrame(natural_size_); 1218 VideoFrame::CreateHoleFrame(natural_size_);
1222 SetCurrentFrameInternal(new_frame); 1219 SetCurrentFrameInternal(new_frame);
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 // media pipeline since we initialize audio and video decoders in sequence. 1622 // media pipeline since we initialize audio and video decoders in sequence.
1626 // But WebMediaPlayerAndroid should not depend on media pipeline's 1623 // But WebMediaPlayerAndroid should not depend on media pipeline's
1627 // implementation detail. 1624 // implementation detail.
1628 DCHECK(cdm_ready_cb_.is_null()); 1625 DCHECK(cdm_ready_cb_.is_null());
1629 cdm_ready_cb_ = cdm_ready_cb; 1626 cdm_ready_cb_ = cdm_ready_cb;
1630 1627
1631 if (cdm_context_) 1628 if (cdm_context_)
1632 SetCdmInternal(base::Bind(&media::IgnoreCdmAttached)); 1629 SetCdmInternal(base::Bind(&media::IgnoreCdmAttached));
1633 } 1630 }
1634 1631
1635 bool WebMediaPlayerAndroid::supportsOverlayFullscreenVideo() { 1632 WebMediaPlayer::OverlayFullscreenVideoMode
1636 return true; 1633 WebMediaPlayerAndroid::getOverlayFullscreenVideoMode() {
1634 return WebMediaPlayer::OverlayFullscreenVideoMode::VideoLayerInvisible;
1637 } 1635 }
1638 1636
1639 void WebMediaPlayerAndroid::enteredFullscreen() { 1637 void WebMediaPlayerAndroid::enteredFullscreen() {
1640 if (is_player_initialized_) 1638 if (is_player_initialized_)
1641 player_manager_->EnterFullscreen(player_id_); 1639 player_manager_->EnterFullscreen(player_id_);
1642 SetNeedsEstablishPeer(false); 1640 SetNeedsEstablishPeer(false);
1643 is_fullscreen_ = true; 1641 is_fullscreen_ = true;
1644 suppress_deleting_texture_ = false; 1642 suppress_deleting_texture_ = false;
1645
1646 // Create a transparent video frame. Blink will already have made the
1647 // background transparent because we returned true from
1648 // supportsOverlayFullscreenVideo(). By making the video frame transparent,
1649 // as well, everything in the LayerTreeView will be transparent except for
1650 // media controls. The video will be on visible on the underlaid surface.
1651 if (!fullscreen_frame_)
1652 fullscreen_frame_ = VideoFrame::CreateTransparentFrame(gfx::Size(1, 1));
1653 SetCurrentFrameInternal(fullscreen_frame_);
1654 client_->repaint();
1655 } 1643 }
1656 1644
1657 bool WebMediaPlayerAndroid::IsHLSStream() const { 1645 bool WebMediaPlayerAndroid::IsHLSStream() const {
1658 const GURL& url = redirected_url_.is_empty() ? url_ : redirected_url_; 1646 const GURL& url = redirected_url_.is_empty() ? url_ : redirected_url_;
1659 return media::MediaCodecUtil::IsHLSURL(url); 1647 return media::MediaCodecUtil::IsHLSURL(url);
1660 } 1648 }
1661 1649
1662 void WebMediaPlayerAndroid::ReportHLSMetrics() const { 1650 void WebMediaPlayerAndroid::ReportHLSMetrics() const {
1663 if (player_type_ != MEDIA_PLAYER_TYPE_URL) 1651 if (player_type_ != MEDIA_PLAYER_TYPE_URL)
1664 return; 1652 return;
(...skipping 15 matching lines...) Expand all
1680 result = PREDICTION_RESULT_PATH_BASED_WAS_BETTER; 1668 result = PREDICTION_RESULT_PATH_BASED_WAS_BETTER;
1681 } else if (is_hls_url == is_hls) { 1669 } else if (is_hls_url == is_hls) {
1682 result = PREDICTION_RESULT_URL_BASED_WAS_BETTER; 1670 result = PREDICTION_RESULT_URL_BASED_WAS_BETTER;
1683 } 1671 }
1684 UMA_HISTOGRAM_ENUMERATION( 1672 UMA_HISTOGRAM_ENUMERATION(
1685 "Media.Android.IsHttpLiveStreamingMediaPredictionResult", 1673 "Media.Android.IsHttpLiveStreamingMediaPredictionResult",
1686 result, PREDICTION_RESULT_MAX); 1674 result, PREDICTION_RESULT_MAX);
1687 } 1675 }
1688 1676
1689 } // namespace content 1677 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.h ('k') | media/blink/webmediaplayer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698