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

Side by Side Diff: content/renderer/media/android/renderer_media_player_manager.cc

Issue 193523002: Encrypted Media: Implement IPC based SetCdm(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments addressed Created 6 years, 9 months 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/renderer/media/android/renderer_media_player_manager.h" 5 #include "content/renderer/media/android/renderer_media_player_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "content/common/media/cdm_messages.h" 9 #include "content/common/media/cdm_messages.h"
10 #include "content/common/media/media_player_messages_android.h" 10 #include "content/common/media/media_player_messages_android.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 blink::WebFrame* frame) { 232 blink::WebFrame* frame) {
233 pending_fullscreen_frame_ = frame; 233 pending_fullscreen_frame_ = frame;
234 Send(new MediaPlayerHostMsg_EnterFullscreen(routing_id(), player_id)); 234 Send(new MediaPlayerHostMsg_EnterFullscreen(routing_id(), player_id));
235 } 235 }
236 236
237 void RendererMediaPlayerManager::ExitFullscreen(int player_id) { 237 void RendererMediaPlayerManager::ExitFullscreen(int player_id) {
238 pending_fullscreen_frame_ = NULL; 238 pending_fullscreen_frame_ = NULL;
239 Send(new MediaPlayerHostMsg_ExitFullscreen(routing_id(), player_id)); 239 Send(new MediaPlayerHostMsg_ExitFullscreen(routing_id(), player_id));
240 } 240 }
241 241
242 void RendererMediaPlayerManager::SetCdm(int player_id, int cdm_id) {
243 if (cdm_id == kInvalidCdmId)
244 return;
245 Send(new MediaPlayerHostMsg_SetCdm(routing_id(), player_id, cdm_id));
246 }
247
242 void RendererMediaPlayerManager::InitializeCdm(int cdm_id, 248 void RendererMediaPlayerManager::InitializeCdm(int cdm_id,
243 ProxyMediaKeys* media_keys, 249 ProxyMediaKeys* media_keys,
244 const std::string& key_system, 250 const std::string& key_system,
245 const GURL& frame_url) { 251 const GURL& frame_url) {
252 DCHECK_NE(cdm_id, kInvalidCdmId);
246 RegisterMediaKeys(cdm_id, media_keys); 253 RegisterMediaKeys(cdm_id, media_keys);
247 Send(new CdmHostMsg_InitializeCdm( 254 Send(new CdmHostMsg_InitializeCdm(
248 routing_id(), cdm_id, key_system, frame_url)); 255 routing_id(), cdm_id, key_system, frame_url));
249 } 256 }
250 257
251 void RendererMediaPlayerManager::CreateSession( 258 void RendererMediaPlayerManager::CreateSession(
252 int cdm_id, 259 int cdm_id,
253 uint32 session_id, 260 uint32 session_id,
254 CdmHostMsg_CreateSession_ContentType content_type, 261 CdmHostMsg_CreateSession_ContentType content_type,
255 const std::vector<uint8>& init_data) { 262 const std::vector<uint8>& init_data) {
263 DCHECK(GetMediaKeys(cdm_id)) << "|cdm_id| not registered.";
256 Send(new CdmHostMsg_CreateSession( 264 Send(new CdmHostMsg_CreateSession(
257 routing_id(), cdm_id, session_id, content_type, init_data)); 265 routing_id(), cdm_id, session_id, content_type, init_data));
258 } 266 }
259 267
260 void RendererMediaPlayerManager::UpdateSession( 268 void RendererMediaPlayerManager::UpdateSession(
261 int cdm_id, 269 int cdm_id,
262 uint32 session_id, 270 uint32 session_id,
263 const std::vector<uint8>& response) { 271 const std::vector<uint8>& response) {
272 DCHECK(GetMediaKeys(cdm_id)) << "|cdm_id| not registered.";
264 Send( 273 Send(
265 new CdmHostMsg_UpdateSession(routing_id(), cdm_id, session_id, response)); 274 new CdmHostMsg_UpdateSession(routing_id(), cdm_id, session_id, response));
266 } 275 }
267 276
268 void RendererMediaPlayerManager::ReleaseSession(int cdm_id, uint32 session_id) { 277 void RendererMediaPlayerManager::ReleaseSession(int cdm_id, uint32 session_id) {
278 DCHECK(GetMediaKeys(cdm_id)) << "|cdm_id| not registered.";
269 Send(new CdmHostMsg_ReleaseSession(routing_id(), cdm_id, session_id)); 279 Send(new CdmHostMsg_ReleaseSession(routing_id(), cdm_id, session_id));
270 } 280 }
271 281
272 void RendererMediaPlayerManager::DestroyCdm(int cdm_id) { 282 void RendererMediaPlayerManager::DestroyCdm(int cdm_id) {
283 DCHECK(GetMediaKeys(cdm_id)) << "|cdm_id| not registered.";
273 Send(new CdmHostMsg_DestroyCdm(routing_id(), cdm_id)); 284 Send(new CdmHostMsg_DestroyCdm(routing_id(), cdm_id));
274 } 285 }
275 286
276 void RendererMediaPlayerManager::OnSessionCreated( 287 void RendererMediaPlayerManager::OnSessionCreated(
277 int cdm_id, 288 int cdm_id,
278 uint32 session_id, 289 uint32 session_id,
279 const std::string& web_session_id) { 290 const std::string& web_session_id) {
280 if (web_session_id.length() > kMaxWebSessionIdLength) { 291 if (web_session_id.length() > kMaxWebSessionIdLength) {
281 OnSessionError(cdm_id, session_id, media::MediaKeys::kUnknownError, 0); 292 OnSessionError(cdm_id, session_id, media::MediaKeys::kUnknownError, 0);
282 return; 293 return;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 438
428 if (player && player->hasVideo()) { 439 if (player && player->hasVideo()) {
429 if (player->UpdateBoundaryRectangle()) 440 if (player->UpdateBoundaryRectangle())
430 (*changes)[player_it->first] = player->GetBoundaryRectangle(); 441 (*changes)[player_it->first] = player->GetBoundaryRectangle();
431 } 442 }
432 } 443 }
433 } 444 }
434 #endif // defined(VIDEO_HOLE) 445 #endif // defined(VIDEO_HOLE)
435 446
436 } // namespace content 447 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698