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/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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_Initialize, OnInitialize) | 132 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_Initialize, OnInitialize) |
133 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_Start, OnStart) | 133 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_Start, OnStart) |
134 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_Seek, OnSeek) | 134 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_Seek, OnSeek) |
135 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_Pause, OnPause) | 135 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_Pause, OnPause) |
136 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_SetVolume, OnSetVolume) | 136 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_SetVolume, OnSetVolume) |
137 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_SetPoster, OnSetPoster) | 137 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_SetPoster, OnSetPoster) |
138 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_Release, OnReleaseResources) | 138 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_Release, OnReleaseResources) |
139 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_DestroyMediaPlayer, OnDestroyPlayer) | 139 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_DestroyMediaPlayer, OnDestroyPlayer) |
140 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_DestroyAllMediaPlayers, | 140 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_DestroyAllMediaPlayers, |
141 DestroyAllMediaPlayers) | 141 DestroyAllMediaPlayers) |
142 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_InitializeCDM, | 142 IPC_MESSAGE_HANDLER(CdmHostMsg_InitializeCDM, OnInitializeCDM) |
143 OnInitializeCDM) | 143 IPC_MESSAGE_HANDLER(CdmHostMsg_CreateSession, OnCreateSession) |
144 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_CreateSession, OnCreateSession) | 144 IPC_MESSAGE_HANDLER(CdmHostMsg_UpdateSession, OnUpdateSession) |
145 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_UpdateSession, OnUpdateSession) | 145 IPC_MESSAGE_HANDLER(CdmHostMsg_ReleaseSession, OnReleaseSession) |
146 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_ReleaseSession, OnReleaseSession) | 146 IPC_MESSAGE_HANDLER(CdmHostMsg_CancelAllPendingSessionCreations, |
147 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_CancelAllPendingSessionCreations, | |
148 OnCancelAllPendingSessionCreations) | 147 OnCancelAllPendingSessionCreations) |
149 #if defined(VIDEO_HOLE) | 148 #if defined(VIDEO_HOLE) |
150 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_NotifyExternalSurface, | 149 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_NotifyExternalSurface, |
151 OnNotifyExternalSurface) | 150 OnNotifyExternalSurface) |
152 #endif // defined(VIDEO_HOLE) | 151 #endif // defined(VIDEO_HOLE) |
153 IPC_MESSAGE_UNHANDLED(handled = false) | 152 IPC_MESSAGE_UNHANDLED(handled = false) |
154 IPC_END_MESSAGE_MAP() | 153 IPC_END_MESSAGE_MAP() |
155 return handled; | 154 return handled; |
156 } | 155 } |
157 | 156 |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 Send(new MediaPlayerMsg_RequestFullscreen(routing_id(), player_id)); | 409 Send(new MediaPlayerMsg_RequestFullscreen(routing_id(), player_id)); |
411 } | 410 } |
412 } | 411 } |
413 | 412 |
414 // The following 5 functions are EME MediaKeySession events. | 413 // The following 5 functions are EME MediaKeySession events. |
415 | 414 |
416 void BrowserMediaPlayerManager::OnSessionCreated( | 415 void BrowserMediaPlayerManager::OnSessionCreated( |
417 int media_keys_id, | 416 int media_keys_id, |
418 uint32 session_id, | 417 uint32 session_id, |
419 const std::string& web_session_id) { | 418 const std::string& web_session_id) { |
420 Send(new MediaKeysMsg_SessionCreated( | 419 Send(new CdmMsg_SessionCreated( |
421 routing_id(), media_keys_id, session_id, web_session_id)); | 420 routing_id(), media_keys_id, session_id, web_session_id)); |
422 } | 421 } |
423 | 422 |
424 void BrowserMediaPlayerManager::OnSessionMessage( | 423 void BrowserMediaPlayerManager::OnSessionMessage( |
425 int media_keys_id, | 424 int media_keys_id, |
426 uint32 session_id, | 425 uint32 session_id, |
427 const std::vector<uint8>& message, | 426 const std::vector<uint8>& message, |
428 const GURL& destination_url) { | 427 const GURL& destination_url) { |
429 Send(new MediaKeysMsg_SessionMessage( | 428 Send(new CdmMsg_SessionMessage( |
430 routing_id(), media_keys_id, session_id, message, destination_url)); | 429 routing_id(), media_keys_id, session_id, message, destination_url)); |
431 } | 430 } |
432 | 431 |
433 void BrowserMediaPlayerManager::OnSessionReady(int media_keys_id, | 432 void BrowserMediaPlayerManager::OnSessionReady(int media_keys_id, |
434 uint32 session_id) { | 433 uint32 session_id) { |
435 Send(new MediaKeysMsg_SessionReady(routing_id(), media_keys_id, session_id)); | 434 Send(new CdmMsg_SessionReady(routing_id(), media_keys_id, session_id)); |
436 } | 435 } |
437 | 436 |
438 void BrowserMediaPlayerManager::OnSessionClosed(int media_keys_id, | 437 void BrowserMediaPlayerManager::OnSessionClosed(int media_keys_id, |
439 uint32 session_id) { | 438 uint32 session_id) { |
440 Send(new MediaKeysMsg_SessionClosed(routing_id(), media_keys_id, session_id)); | 439 Send(new CdmMsg_SessionClosed(routing_id(), media_keys_id, session_id)); |
441 } | 440 } |
442 | 441 |
443 void BrowserMediaPlayerManager::OnSessionError( | 442 void BrowserMediaPlayerManager::OnSessionError( |
444 int media_keys_id, | 443 int media_keys_id, |
445 uint32 session_id, | 444 uint32 session_id, |
446 media::MediaKeys::KeyError error_code, | 445 media::MediaKeys::KeyError error_code, |
447 int system_code) { | 446 int system_code) { |
448 Send(new MediaKeysMsg_SessionError( | 447 Send(new CdmMsg_SessionError( |
449 routing_id(), media_keys_id, session_id, error_code, system_code)); | 448 routing_id(), media_keys_id, session_id, error_code, system_code)); |
450 } | 449 } |
451 | 450 |
452 #if defined(VIDEO_HOLE) | 451 #if defined(VIDEO_HOLE) |
453 void BrowserMediaPlayerManager::AttachExternalVideoSurface(int player_id, | 452 void BrowserMediaPlayerManager::AttachExternalVideoSurface(int player_id, |
454 jobject surface) { | 453 jobject surface) { |
455 MediaPlayerAndroid* player = GetPlayer(player_id); | 454 MediaPlayerAndroid* player = GetPlayer(player_id); |
456 if (player) { | 455 if (player) { |
457 player->SetVideoSurface( | 456 player->SetVideoSurface( |
458 gfx::ScopedJavaSurface::AcquireExternalSurface(surface)); | 457 gfx::ScopedJavaSurface::AcquireExternalSurface(surface)); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 | 615 |
617 AddDrmBridge(media_keys_id, uuid, frame_url); | 616 AddDrmBridge(media_keys_id, uuid, frame_url); |
618 // In EME v0.1b MediaKeys lives in the media element. So the |media_keys_id| | 617 // In EME v0.1b MediaKeys lives in the media element. So the |media_keys_id| |
619 // is the same as the |player_id|. | 618 // is the same as the |player_id|. |
620 OnSetMediaKeys(media_keys_id, media_keys_id); | 619 OnSetMediaKeys(media_keys_id, media_keys_id); |
621 } | 620 } |
622 | 621 |
623 void BrowserMediaPlayerManager::OnCreateSession( | 622 void BrowserMediaPlayerManager::OnCreateSession( |
624 int media_keys_id, | 623 int media_keys_id, |
625 uint32 session_id, | 624 uint32 session_id, |
626 MediaKeysHostMsg_CreateSession_Type content_type, | 625 CdmHostMsg_CreateSession_Type content_type, |
627 const std::vector<uint8>& init_data) { | 626 const std::vector<uint8>& init_data) { |
628 if (init_data.size() > kEmeInitDataMaximum) { | 627 if (init_data.size() > kEmeInitDataMaximum) { |
629 LOG(WARNING) << "InitData for ID: " << media_keys_id | 628 LOG(WARNING) << "InitData for ID: " << media_keys_id |
630 << " too long: " << init_data.size(); | 629 << " too long: " << init_data.size(); |
631 OnSessionError( | 630 OnSessionError( |
632 media_keys_id, session_id, media::MediaKeys::kUnknownError, 0); | 631 media_keys_id, session_id, media::MediaKeys::kUnknownError, 0); |
633 return; | 632 return; |
634 } | 633 } |
635 | 634 |
636 // Convert the session content type into a MIME type. "audio" and "video" | 635 // Convert the session content type into a MIME type. "audio" and "video" |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 if (player->IsPlaying()) | 875 if (player->IsPlaying()) |
877 OnProtectedSurfaceRequested(media_keys_id); | 876 OnProtectedSurfaceRequested(media_keys_id); |
878 } | 877 } |
879 | 878 |
880 void BrowserMediaPlayerManager::ReleaseFullscreenPlayer( | 879 void BrowserMediaPlayerManager::ReleaseFullscreenPlayer( |
881 MediaPlayerAndroid* player) { | 880 MediaPlayerAndroid* player) { |
882 player->Release(); | 881 player->Release(); |
883 } | 882 } |
884 | 883 |
885 } // namespace content | 884 } // namespace content |
OLD | NEW |