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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(MediaKeysHostMsg_InitializeCDM, |
143 OnInitializeCDM) | 143 OnInitializeCDM) |
144 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_CreateSession, OnCreateSession) | 144 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_CreateSession, OnCreateSession) |
145 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_UpdateSession, OnUpdateSession) | 145 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_UpdateSession, OnUpdateSession) |
146 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_ReleaseSession, OnReleaseSession) | 146 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_ReleaseSession, OnReleaseSession) |
147 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_CancelAllPendingSessionCreations, | 147 IPC_MESSAGE_HANDLER(MediaKeysHostMsg_DestroyCdm, OnDestroyCdm) |
148 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 |
158 void BrowserMediaPlayerManager::FullscreenPlayerPlay() { | 157 void BrowserMediaPlayerManager::FullscreenPlayerPlay() { |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 if (!drm_bridge) { | 721 if (!drm_bridge) { |
723 DLOG(WARNING) << "No MediaDrmBridge for ID: " << media_keys_id << " found"; | 722 DLOG(WARNING) << "No MediaDrmBridge for ID: " << media_keys_id << " found"; |
724 OnSessionError( | 723 OnSessionError( |
725 media_keys_id, session_id, media::MediaKeys::kUnknownError, 0); | 724 media_keys_id, session_id, media::MediaKeys::kUnknownError, 0); |
726 return; | 725 return; |
727 } | 726 } |
728 | 727 |
729 drm_bridge->ReleaseSession(session_id); | 728 drm_bridge->ReleaseSession(session_id); |
730 } | 729 } |
731 | 730 |
732 void BrowserMediaPlayerManager::OnCancelAllPendingSessionCreations( | 731 void BrowserMediaPlayerManager::OnDestroyCdm(int media_keys_id) { |
733 int media_keys_id) { | |
734 MediaDrmBridge* drm_bridge = GetDrmBridge(media_keys_id); | 732 MediaDrmBridge* drm_bridge = GetDrmBridge(media_keys_id); |
735 if (!drm_bridge) return; | 733 if (!drm_bridge) return; |
736 | 734 |
| 735 CancelAllPendingSessionCreations(media_keys_id); |
| 736 RemoveDrmBridge(media_keys_id); |
| 737 } |
| 738 |
| 739 void BrowserMediaPlayerManager::CancelAllPendingSessionCreations( |
| 740 int media_keys_id) { |
737 BrowserContext* context = | 741 BrowserContext* context = |
738 web_contents()->GetRenderProcessHost()->GetBrowserContext(); | 742 web_contents()->GetRenderProcessHost()->GetBrowserContext(); |
739 context->CancelProtectedMediaIdentifierPermissionRequests(media_keys_id); | 743 context->CancelProtectedMediaIdentifierPermissionRequests(media_keys_id); |
740 } | 744 } |
741 | 745 |
742 void BrowserMediaPlayerManager::AddPlayer(MediaPlayerAndroid* player) { | 746 void BrowserMediaPlayerManager::AddPlayer(MediaPlayerAndroid* player) { |
743 DCHECK(!GetPlayer(player->player_id())); | 747 DCHECK(!GetPlayer(player->player_id())); |
744 players_.push_back(player); | 748 players_.push_back(player); |
745 if (player->IsRemote()) { | 749 if (player->IsRemote()) { |
746 Send(new MediaPlayerMsg_ConnectedToRemoteDevice(routing_id(), | 750 Send(new MediaPlayerMsg_ConnectedToRemoteDevice(routing_id(), |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 if (player->IsPlaying()) | 880 if (player->IsPlaying()) |
877 OnProtectedSurfaceRequested(media_keys_id); | 881 OnProtectedSurfaceRequested(media_keys_id); |
878 } | 882 } |
879 | 883 |
880 void BrowserMediaPlayerManager::ReleaseFullscreenPlayer( | 884 void BrowserMediaPlayerManager::ReleaseFullscreenPlayer( |
881 MediaPlayerAndroid* player) { | 885 MediaPlayerAndroid* player) { |
882 player->Release(); | 886 player->Release(); |
883 } | 887 } |
884 | 888 |
885 } // namespace content | 889 } // namespace content |
OLD | NEW |