| 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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "third_party/WebKit/public/web/WebDocument.h" | 34 #include "third_party/WebKit/public/web/WebDocument.h" |
| 35 #include "third_party/WebKit/public/web/WebFrame.h" | 35 #include "third_party/WebKit/public/web/WebFrame.h" |
| 36 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 36 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 37 #include "third_party/WebKit/public/web/WebView.h" | 37 #include "third_party/WebKit/public/web/WebView.h" |
| 38 #include "third_party/skia/include/core/SkBitmap.h" | 38 #include "third_party/skia/include/core/SkBitmap.h" |
| 39 #include "third_party/skia/include/core/SkCanvas.h" | 39 #include "third_party/skia/include/core/SkCanvas.h" |
| 40 #include "third_party/skia/include/core/SkPaint.h" | 40 #include "third_party/skia/include/core/SkPaint.h" |
| 41 #include "ui/gfx/image/image.h" | 41 #include "ui/gfx/image/image.h" |
| 42 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" | 42 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" |
| 43 | 43 |
| 44 #if defined(GOOGLE_TV) | |
| 45 #include "content/renderer/media/media_stream_audio_renderer.h" | |
| 46 #include "content/renderer/media/media_stream_client.h" | |
| 47 #endif | |
| 48 | |
| 49 static const uint32 kGLTextureExternalOES = 0x8D65; | 44 static const uint32 kGLTextureExternalOES = 0x8D65; |
| 50 | 45 |
| 51 using blink::WebMediaPlayer; | 46 using blink::WebMediaPlayer; |
| 52 using blink::WebSize; | 47 using blink::WebSize; |
| 53 using blink::WebString; | 48 using blink::WebString; |
| 54 using blink::WebTimeRanges; | 49 using blink::WebTimeRanges; |
| 55 using blink::WebURL; | 50 using blink::WebURL; |
| 56 using gpu::gles2::GLES2Interface; | 51 using gpu::gles2::GLES2Interface; |
| 57 using media::MediaPlayerAndroid; | 52 using media::MediaPlayerAndroid; |
| 58 using media::VideoFrame; | 53 using media::VideoFrame; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 is_playing_(false), | 99 is_playing_(false), |
| 105 playing_started_(false), | 100 playing_started_(false), |
| 106 needs_establish_peer_(true), | 101 needs_establish_peer_(true), |
| 107 stream_texture_proxy_initialized_(false), | 102 stream_texture_proxy_initialized_(false), |
| 108 has_size_info_(false), | 103 has_size_info_(false), |
| 109 has_media_metadata_(false), | 104 has_media_metadata_(false), |
| 110 has_media_info_(false), | 105 has_media_info_(false), |
| 111 stream_texture_factory_(factory), | 106 stream_texture_factory_(factory), |
| 112 needs_external_surface_(false), | 107 needs_external_surface_(false), |
| 113 video_frame_provider_client_(NULL), | 108 video_frame_provider_client_(NULL), |
| 114 #if defined(GOOGLE_TV) | |
| 115 external_surface_threshold_(-1), | |
| 116 demuxer_(NULL), | |
| 117 media_stream_client_(NULL), | |
| 118 #endif // defined(GOOGLE_TV) | |
| 119 pending_playback_(false), | 109 pending_playback_(false), |
| 120 player_type_(MEDIA_PLAYER_TYPE_URL), | 110 player_type_(MEDIA_PLAYER_TYPE_URL), |
| 121 current_time_(0), | 111 current_time_(0), |
| 122 is_remote_(false), | 112 is_remote_(false), |
| 123 media_log_(media_log), | 113 media_log_(media_log), |
| 124 weak_factory_(this) { | 114 weak_factory_(this) { |
| 125 DCHECK(manager_); | 115 DCHECK(manager_); |
| 126 | 116 |
| 127 DCHECK(main_thread_checker_.CalledOnValidThread()); | 117 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 128 | 118 |
| 129 // We want to be notified of |main_loop_| destruction. | 119 // We want to be notified of |main_loop_| destruction. |
| 130 base::MessageLoop::current()->AddDestructionObserver(this); | 120 base::MessageLoop::current()->AddDestructionObserver(this); |
| 131 | 121 |
| 132 player_id_ = manager_->RegisterMediaPlayer(this); | 122 player_id_ = manager_->RegisterMediaPlayer(this); |
| 133 | 123 |
| 134 #if defined(GOOGLE_TV) | |
| 135 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
| 136 switches::kUseExternalVideoSurfaceThresholdInPixels)) { | |
| 137 if (!base::StringToInt( | |
| 138 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
| 139 switches::kUseExternalVideoSurfaceThresholdInPixels), | |
| 140 &external_surface_threshold_)) { | |
| 141 external_surface_threshold_ = -1; | |
| 142 } | |
| 143 } | |
| 144 #endif // defined(GOOGLE_TV) | |
| 145 | |
| 146 #if defined(VIDEO_HOLE) | 124 #if defined(VIDEO_HOLE) |
| 147 // Defer stream texture creation until we are sure it's necessary. | 125 // Defer stream texture creation until we are sure it's necessary. |
| 148 needs_establish_peer_ = false; | 126 needs_establish_peer_ = false; |
| 149 current_frame_ = VideoFrame::CreateBlackFrame(gfx::Size(1, 1)); | 127 current_frame_ = VideoFrame::CreateBlackFrame(gfx::Size(1, 1)); |
| 150 #endif // defined(VIDEO_HOLE) | 128 #endif // defined(VIDEO_HOLE) |
| 151 TryCreateStreamTextureProxyIfNeeded(); | 129 TryCreateStreamTextureProxyIfNeeded(); |
| 152 | 130 |
| 153 if (blink::WebRuntimeFeatures::isPrefixedEncryptedMediaEnabled()) { | 131 if (blink::WebRuntimeFeatures::isPrefixedEncryptedMediaEnabled()) { |
| 154 // TODO(xhwang): Report an error when there is encrypted stream but EME is | 132 // TODO(xhwang): Report an error when there is encrypted stream but EME is |
| 155 // not enabled. Currently the player just doesn't start and waits for ever. | 133 // not enabled. Currently the player just doesn't start and waits for ever. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 185 if (remote_playback_texture_id_) { | 163 if (remote_playback_texture_id_) { |
| 186 stream_texture_factory_->ContextGL()-> | 164 stream_texture_factory_->ContextGL()-> |
| 187 DeleteTextures(1, &remote_playback_texture_id_); | 165 DeleteTextures(1, &remote_playback_texture_id_); |
| 188 } | 166 } |
| 189 | 167 |
| 190 if (base::MessageLoop::current()) | 168 if (base::MessageLoop::current()) |
| 191 base::MessageLoop::current()->RemoveDestructionObserver(this); | 169 base::MessageLoop::current()->RemoveDestructionObserver(this); |
| 192 | 170 |
| 193 if (player_type_ == MEDIA_PLAYER_TYPE_MEDIA_SOURCE && delegate_) | 171 if (player_type_ == MEDIA_PLAYER_TYPE_MEDIA_SOURCE && delegate_) |
| 194 delegate_->PlayerGone(this); | 172 delegate_->PlayerGone(this); |
| 195 | |
| 196 #if defined(GOOGLE_TV) | |
| 197 if (audio_renderer_) { | |
| 198 if (audio_renderer_->IsLocalRenderer()) { | |
| 199 audio_renderer_->Stop(); | |
| 200 } else if (!paused()) { | |
| 201 // The |audio_renderer_| can be shared by multiple remote streams, and | |
| 202 // it will be stopped when WebRtcAudioDeviceImpl goes away. So we simply | |
| 203 // pause the |audio_renderer_| here to avoid re-creating the | |
| 204 // |audio_renderer_|. | |
| 205 audio_renderer_->Pause(); | |
| 206 } | |
| 207 } | |
| 208 if (demuxer_ && !destroy_demuxer_cb_.is_null()) { | |
| 209 media_source_delegate_.reset(); | |
| 210 destroy_demuxer_cb_.Run(); | |
| 211 } | |
| 212 #endif | |
| 213 } | 173 } |
| 214 | 174 |
| 215 void WebMediaPlayerAndroid::load(LoadType load_type, | 175 void WebMediaPlayerAndroid::load(LoadType load_type, |
| 216 const blink::WebURL& url, | 176 const blink::WebURL& url, |
| 217 CORSMode cors_mode) { | 177 CORSMode cors_mode) { |
| 218 switch (load_type) { | 178 switch (load_type) { |
| 219 case LoadTypeURL: | 179 case LoadTypeURL: |
| 220 player_type_ = MEDIA_PLAYER_TYPE_URL; | 180 player_type_ = MEDIA_PLAYER_TYPE_URL; |
| 221 break; | 181 break; |
| 222 | 182 |
| 223 case LoadTypeMediaSource: | 183 case LoadTypeMediaSource: |
| 224 player_type_ = MEDIA_PLAYER_TYPE_MEDIA_SOURCE; | 184 player_type_ = MEDIA_PLAYER_TYPE_MEDIA_SOURCE; |
| 225 break; | 185 break; |
| 226 | 186 |
| 227 case LoadTypeMediaStream: | 187 case LoadTypeMediaStream: |
| 228 #if defined(GOOGLE_TV) | |
| 229 player_type_ = MEDIA_PLAYER_TYPE_MEDIA_STREAM; | |
| 230 break; | |
| 231 #else | |
| 232 CHECK(false) << "WebMediaPlayerAndroid doesn't support MediaStream on " | 188 CHECK(false) << "WebMediaPlayerAndroid doesn't support MediaStream on " |
| 233 "this platform"; | 189 "this platform"; |
| 234 return; | 190 return; |
| 235 #endif | |
| 236 } | 191 } |
| 237 | 192 |
| 238 has_media_metadata_ = false; | 193 has_media_metadata_ = false; |
| 239 has_media_info_ = false; | 194 has_media_info_ = false; |
| 240 | 195 |
| 241 media::SetDecryptorReadyCB set_decryptor_ready_cb; | 196 media::SetDecryptorReadyCB set_decryptor_ready_cb; |
| 242 if (decryptor_) { // |decryptor_| can be NULL is EME if not enabled. | 197 if (decryptor_) { // |decryptor_| can be NULL is EME if not enabled. |
| 243 set_decryptor_ready_cb = base::Bind(&ProxyDecryptor::SetDecryptorReadyCB, | 198 set_decryptor_ready_cb = base::Bind(&ProxyDecryptor::SetDecryptorReadyCB, |
| 244 base::Unretained(decryptor_.get())); | 199 base::Unretained(decryptor_.get())); |
| 245 } | 200 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 260 media_source_delegate_->InitializeMediaSource( | 215 media_source_delegate_->InitializeMediaSource( |
| 261 base::Bind(&WebMediaPlayerAndroid::OnMediaSourceOpened, | 216 base::Bind(&WebMediaPlayerAndroid::OnMediaSourceOpened, |
| 262 weak_factory_.GetWeakPtr()), | 217 weak_factory_.GetWeakPtr()), |
| 263 base::Bind(&WebMediaPlayerAndroid::OnNeedKey, base::Unretained(this)), | 218 base::Bind(&WebMediaPlayerAndroid::OnNeedKey, base::Unretained(this)), |
| 264 set_decryptor_ready_cb, | 219 set_decryptor_ready_cb, |
| 265 base::Bind(&WebMediaPlayerAndroid::UpdateNetworkState, | 220 base::Bind(&WebMediaPlayerAndroid::UpdateNetworkState, |
| 266 weak_factory_.GetWeakPtr()), | 221 weak_factory_.GetWeakPtr()), |
| 267 base::Bind(&WebMediaPlayerAndroid::OnDurationChanged, | 222 base::Bind(&WebMediaPlayerAndroid::OnDurationChanged, |
| 268 weak_factory_.GetWeakPtr())); | 223 weak_factory_.GetWeakPtr())); |
| 269 } | 224 } |
| 270 #if defined(GOOGLE_TV) | |
| 271 // TODO(xhwang): Pass set_decryptor_ready_cb in InitializeMediaStream() to | |
| 272 // enable ClearKey support for Google TV. | |
| 273 if (player_type_ == MEDIA_PLAYER_TYPE_MEDIA_STREAM) { | |
| 274 media_source_delegate_->InitializeMediaStream( | |
| 275 demuxer_, | |
| 276 base::Bind(&WebMediaPlayerAndroid::UpdateNetworkState, | |
| 277 weak_factory_.GetWeakPtr())); | |
| 278 audio_renderer_ = media_stream_client_->GetAudioRenderer(url); | |
| 279 if (audio_renderer_) | |
| 280 audio_renderer_->Start(); | |
| 281 } | |
| 282 #endif | |
| 283 } else { | 225 } else { |
| 284 info_loader_.reset( | 226 info_loader_.reset( |
| 285 new MediaInfoLoader( | 227 new MediaInfoLoader( |
| 286 url, | 228 url, |
| 287 cors_mode, | 229 cors_mode, |
| 288 base::Bind(&WebMediaPlayerAndroid::DidLoadMediaInfo, | 230 base::Bind(&WebMediaPlayerAndroid::DidLoadMediaInfo, |
| 289 base::Unretained(this)))); | 231 base::Unretained(this)))); |
| 290 info_loader_->Start(frame_); | 232 info_loader_->Start(frame_); |
| 291 } | 233 } |
| 292 | 234 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 } | 267 } |
| 326 | 268 |
| 327 void WebMediaPlayerAndroid::play() { | 269 void WebMediaPlayerAndroid::play() { |
| 328 #if defined(VIDEO_HOLE) | 270 #if defined(VIDEO_HOLE) |
| 329 if (hasVideo() && needs_external_surface_ && | 271 if (hasVideo() && needs_external_surface_ && |
| 330 !manager_->IsInFullscreen(frame_)) { | 272 !manager_->IsInFullscreen(frame_)) { |
| 331 DCHECK(!needs_establish_peer_); | 273 DCHECK(!needs_establish_peer_); |
| 332 manager_->RequestExternalSurface(player_id_, last_computed_rect_); | 274 manager_->RequestExternalSurface(player_id_, last_computed_rect_); |
| 333 } | 275 } |
| 334 #endif // defined(VIDEO_HOLE) | 276 #endif // defined(VIDEO_HOLE) |
| 335 #if defined(GOOGLE_TV) | |
| 336 if (audio_renderer_ && paused()) | |
| 337 audio_renderer_->Play(); | |
| 338 #endif // defined(GOOGLE_TV) | |
| 339 | 277 |
| 340 TryCreateStreamTextureProxyIfNeeded(); | 278 TryCreateStreamTextureProxyIfNeeded(); |
| 341 if (hasVideo() && needs_establish_peer_) | 279 if (hasVideo() && needs_establish_peer_) |
| 342 EstablishSurfaceTexturePeer(); | 280 EstablishSurfaceTexturePeer(); |
| 343 | 281 |
| 344 if (paused()) | 282 if (paused()) |
| 345 manager_->Start(player_id_); | 283 manager_->Start(player_id_); |
| 346 UpdatePlayingState(true); | 284 UpdatePlayingState(true); |
| 347 UpdateNetworkState(WebMediaPlayer::NetworkStateLoading); | 285 UpdateNetworkState(WebMediaPlayer::NetworkStateLoading); |
| 348 playing_started_ = true; | 286 playing_started_ = true; |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 } | 662 } |
| 725 client_->repaint(); | 663 client_->repaint(); |
| 726 } | 664 } |
| 727 | 665 |
| 728 void WebMediaPlayerAndroid::OnVideoSizeChanged(int width, int height) { | 666 void WebMediaPlayerAndroid::OnVideoSizeChanged(int width, int height) { |
| 729 has_size_info_ = true; | 667 has_size_info_ = true; |
| 730 if (natural_size_.width == width && natural_size_.height == height) | 668 if (natural_size_.width == width && natural_size_.height == height) |
| 731 return; | 669 return; |
| 732 | 670 |
| 733 #if defined(VIDEO_HOLE) | 671 #if defined(VIDEO_HOLE) |
| 734 bool has_surface_size_restriction = false; | |
| 735 #if defined(GOOGLE_TV) | |
| 736 has_surface_size_restriction = external_surface_threshold_ >= 0 && | |
| 737 external_surface_threshold_ <= width * height; | |
| 738 #endif // defined(GOOGLE_TV) | |
| 739 // Use H/W surface for MSE as the content might be protected. | 672 // Use H/W surface for MSE as the content might be protected. |
| 740 // TODO(qinmin): Change this so that only EME needs the H/W surface | 673 // TODO(qinmin): Change this so that only EME needs the H/W surface |
| 741 if (media_source_delegate_ || has_surface_size_restriction) { | 674 if (media_source_delegate_) { |
| 742 needs_external_surface_ = true; | 675 needs_external_surface_ = true; |
| 743 if (!paused() && !manager_->IsInFullscreen(frame_)) | 676 if (!paused() && !manager_->IsInFullscreen(frame_)) |
| 744 manager_->RequestExternalSurface(player_id_, last_computed_rect_); | 677 manager_->RequestExternalSurface(player_id_, last_computed_rect_); |
| 745 } else if (stream_texture_factory_ && !stream_id_) { | 678 } else if (stream_texture_factory_ && !stream_id_) { |
| 746 // Do deferred stream texture creation finally. | 679 // Do deferred stream texture creation finally. |
| 747 DoCreateStreamTexture(); | 680 DoCreateStreamTexture(); |
| 748 if (paused()) { | 681 if (paused()) { |
| 749 SetNeedsEstablishPeer(true); | 682 SetNeedsEstablishPeer(true); |
| 750 } else { | 683 } else { |
| 751 EstablishSurfaceTexturePeer(); | 684 EstablishSurfaceTexturePeer(); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 media_source_delegate_.reset(); | 846 media_source_delegate_.reset(); |
| 914 { | 847 { |
| 915 base::AutoLock auto_lock(current_frame_lock_); | 848 base::AutoLock auto_lock(current_frame_lock_); |
| 916 current_frame_ = NULL; | 849 current_frame_ = NULL; |
| 917 } | 850 } |
| 918 is_remote_ = false; | 851 is_remote_ = false; |
| 919 manager_ = NULL; | 852 manager_ = NULL; |
| 920 } | 853 } |
| 921 | 854 |
| 922 void WebMediaPlayerAndroid::Pause(bool is_media_related_action) { | 855 void WebMediaPlayerAndroid::Pause(bool is_media_related_action) { |
| 923 #if defined(GOOGLE_TV) | |
| 924 if (audio_renderer_ && !paused()) | |
| 925 audio_renderer_->Pause(); | |
| 926 #endif | |
| 927 manager_->Pause(player_id_, is_media_related_action); | 856 manager_->Pause(player_id_, is_media_related_action); |
| 928 UpdatePlayingState(false); | 857 UpdatePlayingState(false); |
| 929 } | 858 } |
| 930 | 859 |
| 931 void WebMediaPlayerAndroid::DrawRemotePlaybackIcon() { | 860 void WebMediaPlayerAndroid::DrawRemotePlaybackIcon() { |
| 932 DCHECK(main_thread_checker_.CalledOnValidThread()); | 861 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 933 if (!video_weblayer_) | 862 if (!video_weblayer_) |
| 934 return; | 863 return; |
| 935 | 864 |
| 936 // TODO(johnme): Should redraw this frame if the layer bounds change; but | 865 // TODO(johnme): Should redraw this frame if the layer bounds change; but |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1359 if (current_key_system_.isEmpty() || key_system != current_key_system_) | 1288 if (current_key_system_.isEmpty() || key_system != current_key_system_) |
| 1360 return WebMediaPlayer::MediaKeyExceptionInvalidPlayerState; | 1289 return WebMediaPlayer::MediaKeyExceptionInvalidPlayerState; |
| 1361 | 1290 |
| 1362 decryptor_->CancelKeyRequest(session_id.utf8()); | 1291 decryptor_->CancelKeyRequest(session_id.utf8()); |
| 1363 return WebMediaPlayer::MediaKeyExceptionNoError; | 1292 return WebMediaPlayer::MediaKeyExceptionNoError; |
| 1364 } | 1293 } |
| 1365 | 1294 |
| 1366 void WebMediaPlayerAndroid::OnKeyAdded(const std::string& session_id) { | 1295 void WebMediaPlayerAndroid::OnKeyAdded(const std::string& session_id) { |
| 1367 EmeUMAHistogramCounts(current_key_system_, "KeyAdded", 1); | 1296 EmeUMAHistogramCounts(current_key_system_, "KeyAdded", 1); |
| 1368 | 1297 |
| 1369 #if defined(GOOGLE_TV) | |
| 1370 if (media_source_delegate_) | |
| 1371 media_source_delegate_->NotifyKeyAdded(current_key_system_.utf8()); | |
| 1372 #endif // defined(GOOGLE_TV) | |
| 1373 | |
| 1374 client_->keyAdded(current_key_system_, WebString::fromUTF8(session_id)); | 1298 client_->keyAdded(current_key_system_, WebString::fromUTF8(session_id)); |
| 1375 } | 1299 } |
| 1376 | 1300 |
| 1377 void WebMediaPlayerAndroid::OnKeyError(const std::string& session_id, | 1301 void WebMediaPlayerAndroid::OnKeyError(const std::string& session_id, |
| 1378 media::MediaKeys::KeyError error_code, | 1302 media::MediaKeys::KeyError error_code, |
| 1379 int system_code) { | 1303 int system_code) { |
| 1380 EmeUMAHistogramEnumeration(current_key_system_, "KeyError", | 1304 EmeUMAHistogramEnumeration(current_key_system_, "KeyError", |
| 1381 error_code, media::MediaKeys::kMaxKeyError); | 1305 error_code, media::MediaKeys::kMaxKeyError); |
| 1382 | 1306 |
| 1383 client_->keyError( | 1307 client_->keyError( |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1422 init_data_type_ = type; | 1346 init_data_type_ = type; |
| 1423 | 1347 |
| 1424 const uint8* init_data_ptr = init_data.empty() ? NULL : &init_data[0]; | 1348 const uint8* init_data_ptr = init_data.empty() ? NULL : &init_data[0]; |
| 1425 // TODO(xhwang): Drop |keySystem| and |sessionId| in keyNeeded() call. | 1349 // TODO(xhwang): Drop |keySystem| and |sessionId| in keyNeeded() call. |
| 1426 client_->keyNeeded(WebString(), | 1350 client_->keyNeeded(WebString(), |
| 1427 WebString(), | 1351 WebString(), |
| 1428 init_data_ptr, | 1352 init_data_ptr, |
| 1429 init_data.size()); | 1353 init_data.size()); |
| 1430 } | 1354 } |
| 1431 | 1355 |
| 1432 #if defined(GOOGLE_TV) | |
| 1433 bool WebMediaPlayerAndroid::InjectMediaStream( | |
| 1434 MediaStreamClient* media_stream_client, | |
| 1435 media::Demuxer* demuxer, | |
| 1436 const base::Closure& destroy_demuxer_cb) { | |
| 1437 DCHECK(!demuxer); | |
| 1438 media_stream_client_ = media_stream_client; | |
| 1439 demuxer_ = demuxer; | |
| 1440 destroy_demuxer_cb_ = destroy_demuxer_cb; | |
| 1441 return true; | |
| 1442 } | |
| 1443 #endif | |
| 1444 | |
| 1445 void WebMediaPlayerAndroid::DoReleaseRemotePlaybackTexture(uint32 sync_point) { | 1356 void WebMediaPlayerAndroid::DoReleaseRemotePlaybackTexture(uint32 sync_point) { |
| 1446 DCHECK(main_thread_checker_.CalledOnValidThread()); | 1357 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 1447 DCHECK(remote_playback_texture_id_); | 1358 DCHECK(remote_playback_texture_id_); |
| 1448 | 1359 |
| 1449 GLES2Interface* gl = stream_texture_factory_->ContextGL(); | 1360 GLES2Interface* gl = stream_texture_factory_->ContextGL(); |
| 1450 | 1361 |
| 1451 if (sync_point) | 1362 if (sync_point) |
| 1452 gl->WaitSyncPointCHROMIUM(sync_point); | 1363 gl->WaitSyncPointCHROMIUM(sync_point); |
| 1453 gl->DeleteTextures(1, &remote_playback_texture_id_); | 1364 gl->DeleteTextures(1, &remote_playback_texture_id_); |
| 1454 remote_playback_texture_id_ = 0; | 1365 remote_playback_texture_id_ = 0; |
| 1455 } | 1366 } |
| 1456 | 1367 |
| 1457 void WebMediaPlayerAndroid::enterFullscreen() { | 1368 void WebMediaPlayerAndroid::enterFullscreen() { |
| 1458 if (manager_->CanEnterFullscreen(frame_)) { | 1369 if (manager_->CanEnterFullscreen(frame_)) { |
| 1459 manager_->EnterFullscreen(player_id_); | 1370 manager_->EnterFullscreen(player_id_); |
| 1460 SetNeedsEstablishPeer(false); | 1371 SetNeedsEstablishPeer(false); |
| 1461 } | 1372 } |
| 1462 } | 1373 } |
| 1463 | 1374 |
| 1464 void WebMediaPlayerAndroid::exitFullscreen() { | 1375 void WebMediaPlayerAndroid::exitFullscreen() { |
| 1465 manager_->ExitFullscreen(player_id_); | 1376 manager_->ExitFullscreen(player_id_); |
| 1466 } | 1377 } |
| 1467 | 1378 |
| 1468 bool WebMediaPlayerAndroid::canEnterFullscreen() const { | 1379 bool WebMediaPlayerAndroid::canEnterFullscreen() const { |
| 1469 return manager_->CanEnterFullscreen(frame_); | 1380 return manager_->CanEnterFullscreen(frame_); |
| 1470 } | 1381 } |
| 1471 | 1382 |
| 1472 } // namespace content | 1383 } // namespace content |
| OLD | NEW |