Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 272 } | 272 } |
| 273 | 273 |
| 274 InitializePlayer( | 274 InitializePlayer( |
| 275 redirected_url, first_party_for_cookies, allow_stored_credentials, 0); | 275 redirected_url, first_party_for_cookies, allow_stored_credentials, 0); |
| 276 | 276 |
| 277 UpdateNetworkState(WebMediaPlayer::NetworkStateIdle); | 277 UpdateNetworkState(WebMediaPlayer::NetworkStateIdle); |
| 278 } | 278 } |
| 279 | 279 |
| 280 void WebMediaPlayerAndroid::play() { | 280 void WebMediaPlayerAndroid::play() { |
| 281 DCHECK(main_thread_checker_.CalledOnValidThread()); | 281 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 282 | |
| 283 // For HLS streams, some devices cannot detect the video size unless a surface | |
| 284 // texture is bind to it. See http://crbug.com/400145. | |
| 282 #if defined(VIDEO_HOLE) | 285 #if defined(VIDEO_HOLE) |
| 283 if (hasVideo() && needs_external_surface_ && | 286 if ((hasVideo() || IsHLSStream()) && needs_external_surface_ && |
| 284 !player_manager_->IsInFullscreen(frame_)) { | 287 !player_manager_->IsInFullscreen(frame_)) { |
| 285 DCHECK(!needs_establish_peer_); | 288 DCHECK(!needs_establish_peer_); |
| 286 player_manager_->RequestExternalSurface(player_id_, last_computed_rect_); | 289 player_manager_->RequestExternalSurface(player_id_, last_computed_rect_); |
| 287 } | 290 } |
| 288 #endif // defined(VIDEO_HOLE) | 291 #endif // defined(VIDEO_HOLE) |
| 289 | 292 |
| 290 TryCreateStreamTextureProxyIfNeeded(); | 293 TryCreateStreamTextureProxyIfNeeded(); |
| 291 // There is no need to establish the surface texture peer for fullscreen | 294 // There is no need to establish the surface texture peer for fullscreen |
| 292 // video. | 295 // video. |
| 293 if (hasVideo() && needs_establish_peer_ && | 296 if ((hasVideo() || IsHLSStream()) && needs_establish_peer_ && |
| 294 !player_manager_->IsInFullscreen(frame_)) { | 297 !player_manager_->IsInFullscreen(frame_)) { |
| 295 EstablishSurfaceTexturePeer(); | 298 EstablishSurfaceTexturePeer(); |
| 296 } | 299 } |
| 297 | 300 |
| 298 if (paused()) | 301 if (paused()) |
| 299 player_manager_->Start(player_id_); | 302 player_manager_->Start(player_id_); |
| 300 UpdatePlayingState(true); | 303 UpdatePlayingState(true); |
| 301 UpdateNetworkState(WebMediaPlayer::NetworkStateLoading); | 304 UpdateNetworkState(WebMediaPlayer::NetworkStateLoading); |
| 302 } | 305 } |
| 303 | 306 |
| (...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1720 if (player_manager_->CanEnterFullscreen(frame_)) { | 1723 if (player_manager_->CanEnterFullscreen(frame_)) { |
| 1721 player_manager_->EnterFullscreen(player_id_, frame_); | 1724 player_manager_->EnterFullscreen(player_id_, frame_); |
| 1722 SetNeedsEstablishPeer(false); | 1725 SetNeedsEstablishPeer(false); |
| 1723 } | 1726 } |
| 1724 } | 1727 } |
| 1725 | 1728 |
| 1726 bool WebMediaPlayerAndroid::canEnterFullscreen() const { | 1729 bool WebMediaPlayerAndroid::canEnterFullscreen() const { |
| 1727 return player_manager_->CanEnterFullscreen(frame_); | 1730 return player_manager_->CanEnterFullscreen(frame_); |
| 1728 } | 1731 } |
| 1729 | 1732 |
| 1733 bool WebMediaPlayerAndroid::IsHLSStream() const { | |
| 1734 std::string mime; | |
| 1735 if (!net::GetMimeTypeFromFile(base::FilePath(url_.path()), &mime)) | |
| 1736 return false; | |
| 1737 return !mime.compare("application/x-mpegurl"); | |
|
miroslav
2015/01/13 18:47:17
How about vnd.apple.mpegURL?
| |
| 1738 } | |
| 1739 | |
| 1730 } // namespace content | 1740 } // namespace content |
| OLD | NEW |