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

Side by Side Diff: content/renderer/media/crypto/ppapi_decryptor.cc

Issue 166273009: PpapiDecryptor: Call NewKeyCB on OnSessionReady(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments addressed Created 6 years, 10 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/crypto/ppapi_decryptor.h" 5 #include "content/renderer/media/crypto/ppapi_decryptor.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 const uint8* response, 130 const uint8* response,
131 int response_length) { 131 int response_length) {
132 DVLOG(2) << __FUNCTION__; 132 DVLOG(2) << __FUNCTION__;
133 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); 133 DCHECK(render_loop_proxy_->BelongsToCurrentThread());
134 134
135 if (!plugin_cdm_delegate_ || !plugin_cdm_delegate_->UpdateSession( 135 if (!plugin_cdm_delegate_ || !plugin_cdm_delegate_->UpdateSession(
136 session_id, response, response_length)) { 136 session_id, response, response_length)) {
137 ReportFailureToCallPlugin(session_id); 137 ReportFailureToCallPlugin(session_id);
138 return; 138 return;
139 } 139 }
140
141 if (!new_audio_key_cb_.is_null())
142 new_audio_key_cb_.Run();
143
144 if (!new_video_key_cb_.is_null())
145 new_video_key_cb_.Run();
146 } 140 }
147 141
148 void PpapiDecryptor::ReleaseSession(uint32 session_id) { 142 void PpapiDecryptor::ReleaseSession(uint32 session_id) {
149 DVLOG(2) << __FUNCTION__; 143 DVLOG(2) << __FUNCTION__;
150 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); 144 DCHECK(render_loop_proxy_->BelongsToCurrentThread());
151 145
152 if (!plugin_cdm_delegate_ || 146 if (!plugin_cdm_delegate_ ||
153 !plugin_cdm_delegate_->ReleaseSession(session_id)) { 147 !plugin_cdm_delegate_->ReleaseSession(session_id)) {
154 ReportFailureToCallPlugin(session_id); 148 ReportFailureToCallPlugin(session_id);
155 return; 149 return;
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 339
346 void PpapiDecryptor::OnSessionMessage(uint32 session_id, 340 void PpapiDecryptor::OnSessionMessage(uint32 session_id,
347 const std::vector<uint8>& message, 341 const std::vector<uint8>& message,
348 const std::string& destination_url) { 342 const std::string& destination_url) {
349 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); 343 DCHECK(render_loop_proxy_->BelongsToCurrentThread());
350 session_message_cb_.Run(session_id, message, destination_url); 344 session_message_cb_.Run(session_id, message, destination_url);
351 } 345 }
352 346
353 void PpapiDecryptor::OnSessionReady(uint32 session_id) { 347 void PpapiDecryptor::OnSessionReady(uint32 session_id) {
354 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); 348 DCHECK(render_loop_proxy_->BelongsToCurrentThread());
349
350 // Based on the spec, we need to resume playback when a session is updated, or
ddorwin 2014/02/19 00:38:13 "updated" is a bit ambiguous. It's really when upd
xhwang 2014/02/19 00:46:42 Done.
351 // when a session is loaded. In both cases, the CDM fires OnSessionReady()
ddorwin 2014/02/19 00:38:13 same/similar: successfully loaded
xhwang 2014/02/19 00:46:42 Done.
352 // event. So we choose to call the NewKeyCBs here.
353 // TODO(xhwang): Rename OnSessionReady callback to OnSessionUpdated.
ddorwin 2014/02/19 00:38:13 SessionUpdated does not seem to cover the loaded c
xhwang 2014/02/19 00:46:42 Done.
354 if (!new_audio_key_cb_.is_null())
355 new_audio_key_cb_.Run();
356
357 if (!new_video_key_cb_.is_null())
358 new_video_key_cb_.Run();
359
355 session_ready_cb_.Run(session_id); 360 session_ready_cb_.Run(session_id);
356 } 361 }
357 362
358 void PpapiDecryptor::OnSessionClosed(uint32 session_id) { 363 void PpapiDecryptor::OnSessionClosed(uint32 session_id) {
359 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); 364 DCHECK(render_loop_proxy_->BelongsToCurrentThread());
360 session_closed_cb_.Run(session_id); 365 session_closed_cb_.Run(session_id);
361 } 366 }
362 367
363 void PpapiDecryptor::OnSessionError(uint32 session_id, 368 void PpapiDecryptor::OnSessionError(uint32 session_id,
364 media::MediaKeys::KeyError error_code, 369 media::MediaKeys::KeyError error_code,
365 int system_code) { 370 int system_code) {
366 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); 371 DCHECK(render_loop_proxy_->BelongsToCurrentThread());
367 session_error_cb_.Run(session_id, error_code, system_code); 372 session_error_cb_.Run(session_id, error_code, system_code);
368 } 373 }
369 374
370 void PpapiDecryptor::OnFatalPluginError() { 375 void PpapiDecryptor::OnFatalPluginError() {
371 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); 376 DCHECK(render_loop_proxy_->BelongsToCurrentThread());
372 DCHECK(plugin_cdm_delegate_); 377 DCHECK(plugin_cdm_delegate_);
373 plugin_cdm_delegate_ = NULL; 378 plugin_cdm_delegate_ = NULL;
374 plugin_instance_ = NULL; 379 plugin_instance_ = NULL;
375 base::ResetAndReturn(&destroy_plugin_cb_).Run(); 380 base::ResetAndReturn(&destroy_plugin_cb_).Run();
376 } 381 }
377 382
378 } // namespace content 383 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | media/cdm/ppapi/external_clear_key/clear_key_cdm.h » ('j') | media/cdm/ppapi/external_clear_key/clear_key_cdm.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698