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

Side by Side Diff: content/browser/media/android/browser_media_player_manager.cc

Issue 110683002: Split the hole punching logic from GOOGLE_TV ifdef to VIDEO_HOLE (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years 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 | Annotate | Revision Log
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/browser/media/android/browser_media_player_manager.h" 5 #include "content/browser/media/android/browser_media_player_manager.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "content/browser/android/content_view_core_impl.h" 8 #include "content/browser/android/content_view_core_impl.h"
9 #include "content/browser/media/android/browser_demuxer_android.h" 9 #include "content/browser/media/android/browser_demuxer_android.h"
10 #include "content/browser/media/android/media_resource_getter_impl.h" 10 #include "content/browser/media/android/media_resource_getter_impl.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_SetVolume, OnSetVolume) 127 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_SetVolume, OnSetVolume)
128 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_Release, OnReleaseResources) 128 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_Release, OnReleaseResources)
129 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_DestroyMediaPlayer, OnDestroyPlayer) 129 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_DestroyMediaPlayer, OnDestroyPlayer)
130 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_DestroyAllMediaPlayers, 130 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_DestroyAllMediaPlayers,
131 DestroyAllMediaPlayers) 131 DestroyAllMediaPlayers)
132 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_InitializeCDM, 132 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_InitializeCDM,
133 OnInitializeCDM) 133 OnInitializeCDM)
134 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_CreateSession, OnCreateSession) 134 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_CreateSession, OnCreateSession)
135 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_UpdateSession, OnUpdateSession) 135 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_UpdateSession, OnUpdateSession)
136 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_ReleaseSession, OnReleaseSession) 136 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_ReleaseSession, OnReleaseSession)
137 #if defined(GOOGLE_TV) 137 #if defined(VIDEO_HOLE)
138 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_NotifyExternalSurface, 138 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_NotifyExternalSurface,
139 OnNotifyExternalSurface) 139 OnNotifyExternalSurface)
140 #endif 140 #endif // defined(VIDEO_HOLE)
141 IPC_MESSAGE_UNHANDLED(handled = false) 141 IPC_MESSAGE_UNHANDLED(handled = false)
142 IPC_END_MESSAGE_MAP() 142 IPC_END_MESSAGE_MAP()
143 return handled; 143 return handled;
144 } 144 }
145 145
146 void BrowserMediaPlayerManager::FullscreenPlayerPlay() { 146 void BrowserMediaPlayerManager::FullscreenPlayerPlay() {
147 MediaPlayerAndroid* player = GetFullscreenPlayer(); 147 MediaPlayerAndroid* player = GetFullscreenPlayer();
148 if (player) { 148 if (player) {
149 if (fullscreen_player_is_released_) { 149 if (fullscreen_player_is_released_) {
150 video_view_->OpenVideo(); 150 video_view_->OpenVideo();
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 402
403 void BrowserMediaPlayerManager::OnSessionError( 403 void BrowserMediaPlayerManager::OnSessionError(
404 int media_keys_id, 404 int media_keys_id,
405 uint32 session_id, 405 uint32 session_id,
406 media::MediaKeys::KeyError error_code, 406 media::MediaKeys::KeyError error_code,
407 int system_code) { 407 int system_code) {
408 Send(new MediaKeysMsg_SessionError( 408 Send(new MediaKeysMsg_SessionError(
409 routing_id(), media_keys_id, session_id, error_code, system_code)); 409 routing_id(), media_keys_id, session_id, error_code, system_code));
410 } 410 }
411 411
412 #if defined(GOOGLE_TV) 412 #if defined(VIDEO_HOLE)
413 void BrowserMediaPlayerManager::AttachExternalVideoSurface(int player_id, 413 void BrowserMediaPlayerManager::AttachExternalVideoSurface(int player_id,
414 jobject surface) { 414 jobject surface) {
415 MediaPlayerAndroid* player = GetPlayer(player_id); 415 MediaPlayerAndroid* player = GetPlayer(player_id);
416 if (player) { 416 if (player) {
417 player->SetVideoSurface( 417 player->SetVideoSurface(
418 gfx::ScopedJavaSurface::AcquireExternalSurface(surface)); 418 gfx::ScopedJavaSurface::AcquireExternalSurface(surface));
419 } 419 }
420 } 420 }
421 421
422 void BrowserMediaPlayerManager::DetachExternalVideoSurface(int player_id) { 422 void BrowserMediaPlayerManager::DetachExternalVideoSurface(int player_id) {
423 MediaPlayerAndroid* player = GetPlayer(player_id); 423 MediaPlayerAndroid* player = GetPlayer(player_id);
424 if (player) 424 if (player)
425 player->SetVideoSurface(gfx::ScopedJavaSurface()); 425 player->SetVideoSurface(gfx::ScopedJavaSurface());
426 } 426 }
427 427
428 void BrowserMediaPlayerManager::OnNotifyExternalSurface( 428 void BrowserMediaPlayerManager::OnNotifyExternalSurface(
429 int player_id, bool is_request, const gfx::RectF& rect) { 429 int player_id, bool is_request, const gfx::RectF& rect) {
430 if (!web_contents_) 430 if (!web_contents_)
431 return; 431 return;
432 432
433 WebContentsViewAndroid* view = 433 WebContentsViewAndroid* view =
434 static_cast<WebContentsViewAndroid*>(web_contents_->GetView()); 434 static_cast<WebContentsViewAndroid*>(web_contents_->GetView());
435 if (view) 435 if (view)
436 view->NotifyExternalSurface(player_id, is_request, rect); 436 view->NotifyExternalSurface(player_id, is_request, rect);
437 } 437 }
438 #endif 438 #endif // defined(VIDEO_HOLE)
439 439
440 void BrowserMediaPlayerManager::DisableFullscreenEncryptedMediaPlayback() { 440 void BrowserMediaPlayerManager::DisableFullscreenEncryptedMediaPlayback() {
441 if (fullscreen_player_id_ == -1) 441 if (fullscreen_player_id_ == -1)
442 return; 442 return;
443 443
444 // If the fullscreen player is not playing back encrypted video, do nothing. 444 // If the fullscreen player is not playing back encrypted video, do nothing.
445 MediaDrmBridge* drm_bridge = GetDrmBridge(fullscreen_player_id_); 445 MediaDrmBridge* drm_bridge = GetDrmBridge(fullscreen_player_id_);
446 if (!drm_bridge) 446 if (!drm_bridge)
447 return; 447 return;
448 448
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 player->SetVolume(volume); 529 player->SetVolume(volume);
530 } 530 }
531 531
532 void BrowserMediaPlayerManager::OnReleaseResources(int player_id) { 532 void BrowserMediaPlayerManager::OnReleaseResources(int player_id) {
533 MediaPlayerAndroid* player = GetPlayer(player_id); 533 MediaPlayerAndroid* player = GetPlayer(player_id);
534 if (player) 534 if (player)
535 player->Release(); 535 player->Release();
536 if (player_id == fullscreen_player_id_) 536 if (player_id == fullscreen_player_id_)
537 fullscreen_player_is_released_ = true; 537 fullscreen_player_is_released_ = true;
538 538
539 #if defined(GOOGLE_TV) 539 #if defined(VIDEO_HOLE)
540 WebContentsViewAndroid* view = 540 WebContentsViewAndroid* view =
541 static_cast<WebContentsViewAndroid*>(web_contents_->GetView()); 541 static_cast<WebContentsViewAndroid*>(web_contents_->GetView());
542 if (view) 542 if (view)
543 view->NotifyExternalSurface(player_id, false, gfx::RectF()); 543 view->NotifyExternalSurface(player_id, false, gfx::RectF());
544 #endif 544 #endif // defined(VIDEO_HOLE)
545 } 545 }
546 546
547 void BrowserMediaPlayerManager::OnDestroyPlayer(int player_id) { 547 void BrowserMediaPlayerManager::OnDestroyPlayer(int player_id) {
548 RemovePlayer(player_id); 548 RemovePlayer(player_id);
549 if (fullscreen_player_id_ == player_id) 549 if (fullscreen_player_id_ == player_id)
550 fullscreen_player_id_ = -1; 550 fullscreen_player_id_ = -1;
551 } 551 }
552 552
553 void BrowserMediaPlayerManager::OnInitializeCDM( 553 void BrowserMediaPlayerManager::OnInitializeCDM(
554 int media_keys_id, 554 int media_keys_id,
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 if (pending_fullscreen_player_id_ != media_keys_id) 771 if (pending_fullscreen_player_id_ != media_keys_id)
772 return; 772 return;
773 773
774 pending_fullscreen_player_id_ = -1; 774 pending_fullscreen_player_id_ = -1;
775 MediaPlayerAndroid* player = GetPlayer(media_keys_id); 775 MediaPlayerAndroid* player = GetPlayer(media_keys_id);
776 if (player->IsPlaying()) 776 if (player->IsPlaying())
777 OnProtectedSurfaceRequested(media_keys_id); 777 OnProtectedSurfaceRequested(media_keys_id);
778 } 778 }
779 779
780 } // namespace content 780 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/android/browser_media_player_manager.h ('k') | content/browser/web_contents/web_contents_view_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698