Commit 4071f5ea authored by qinmin@chromium.org's avatar qinmin@chromium.org

Fix HLS playback on Galaxy S4

Galaxy S4 requires a surface texture in order for the media player to report correct video size.
So bind a texture to MediaPlayer whenever the video is HLS

BUG=400145

Review URL: https://codereview.chromium.org/478403002

Cr-Commit-Position: refs/heads/master@{#291184}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291184 0039d316-1c4b-4281-b951-d872f2087c98
parent 6b3552ad
...@@ -279,8 +279,11 @@ void WebMediaPlayerAndroid::DidLoadMediaInfo( ...@@ -279,8 +279,11 @@ void WebMediaPlayerAndroid::DidLoadMediaInfo(
void WebMediaPlayerAndroid::play() { void WebMediaPlayerAndroid::play() {
DCHECK(main_thread_checker_.CalledOnValidThread()); DCHECK(main_thread_checker_.CalledOnValidThread());
// For HLS streams, some devices cannot detect the video size unless a surface
// texture is bind to it. See http://crbug.com/400145.
#if defined(VIDEO_HOLE) #if defined(VIDEO_HOLE)
if (hasVideo() && needs_external_surface_ && if ((hasVideo() || IsHLSStream()) && needs_external_surface_ &&
!player_manager_->IsInFullscreen(frame_)) { !player_manager_->IsInFullscreen(frame_)) {
DCHECK(!needs_establish_peer_); DCHECK(!needs_establish_peer_);
player_manager_->RequestExternalSurface(player_id_, last_computed_rect_); player_manager_->RequestExternalSurface(player_id_, last_computed_rect_);
...@@ -290,7 +293,7 @@ void WebMediaPlayerAndroid::play() { ...@@ -290,7 +293,7 @@ void WebMediaPlayerAndroid::play() {
TryCreateStreamTextureProxyIfNeeded(); TryCreateStreamTextureProxyIfNeeded();
// There is no need to establish the surface texture peer for fullscreen // There is no need to establish the surface texture peer for fullscreen
// video. // video.
if (hasVideo() && needs_establish_peer_ && if ((hasVideo() || IsHLSStream()) && needs_establish_peer_ &&
!player_manager_->IsInFullscreen(frame_)) { !player_manager_->IsInFullscreen(frame_)) {
EstablishSurfaceTexturePeer(); EstablishSurfaceTexturePeer();
} }
...@@ -1735,4 +1738,11 @@ bool WebMediaPlayerAndroid::canEnterFullscreen() const { ...@@ -1735,4 +1738,11 @@ bool WebMediaPlayerAndroid::canEnterFullscreen() const {
return player_manager_->CanEnterFullscreen(frame_); return player_manager_->CanEnterFullscreen(frame_);
} }
bool WebMediaPlayerAndroid::IsHLSStream() const {
std::string mime;
if (!net::GetMimeTypeFromFile(base::FilePath(url_.path()), &mime))
return false;
return !mime.compare("application/x-mpegurl");
}
} // namespace content } // namespace content
...@@ -317,6 +317,8 @@ class WebMediaPlayerAndroid : public blink::WebMediaPlayer, ...@@ -317,6 +317,8 @@ class WebMediaPlayerAndroid : public blink::WebMediaPlayer,
GrSurfaceOrigin origin, GrSurfaceOrigin origin,
GrPixelConfig config); GrPixelConfig config);
bool IsHLSStream() const;
blink::WebFrame* const frame_; blink::WebFrame* const frame_;
blink::WebMediaPlayerClient* const client_; blink::WebMediaPlayerClient* const client_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment