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

Side by Side Diff: media/cdm/ppapi/cdm_wrapper.h

Issue 497153005: ReleaseSession() should call RemoveSession() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
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 #ifndef MEDIA_CDM_PPAPI_CDM_WRAPPER_H_ 5 #ifndef MEDIA_CDM_PPAPI_CDM_WRAPPER_H_
6 #define MEDIA_CDM_PPAPI_CDM_WRAPPER_H_ 6 #define MEDIA_CDM_PPAPI_CDM_WRAPPER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <queue> 9 #include <queue>
10 #include <string> 10 #include <string>
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 uint32_t init_data_size, 49 uint32_t init_data_size,
50 cdm::SessionType session_type) = 0; 50 cdm::SessionType session_type) = 0;
51 virtual void LoadSession(uint32_t promise_id, 51 virtual void LoadSession(uint32_t promise_id,
52 const char* web_session_id, 52 const char* web_session_id,
53 uint32_t web_session_id_size) = 0; 53 uint32_t web_session_id_size) = 0;
54 virtual void UpdateSession(uint32_t promise_id, 54 virtual void UpdateSession(uint32_t promise_id,
55 const char* web_session_id, 55 const char* web_session_id,
56 uint32_t web_session_id_size, 56 uint32_t web_session_id_size,
57 const uint8_t* response, 57 const uint8_t* response,
58 uint32_t response_size) = 0; 58 uint32_t response_size) = 0;
59 virtual void CloseSession(uint32_t promise_id, 59 virtual bool CloseSession(uint32_t promise_id,
xhwang 2014/08/23 00:01:48 We can change the return value back to void once w
jrummell 2014/08/23 00:27:15 Done.
60 const char* web_session_id, 60 const char* web_session_id,
61 uint32_t web_session_id_size) = 0; 61 uint32_t web_session_id_size) = 0;
62 virtual bool RemoveSession(uint32_t promise_id, 62 virtual void RemoveSession(uint32_t promise_id,
63 const char* web_session_id, 63 const char* web_session_id,
64 uint32_t web_session_id_size) = 0; 64 uint32_t web_session_id_size) = 0;
xhwang 2014/08/23 00:01:48 nit: swap the order of CloseSession and RemoveSess
ddorwin 2014/08/23 00:14:30 Actually, the CdmAdapter order is "wrong". I am fi
jrummell 2014/08/23 00:27:15 Fixed CdmAdapter.
jrummell 2014/08/23 00:27:15 Fixed CdmAdapter instead.
65 virtual bool GetUsableKeyIds(uint32_t promise_id, 65 virtual bool GetUsableKeyIds(uint32_t promise_id,
66 const char* web_session_id, 66 const char* web_session_id,
67 uint32_t web_session_id_size) = 0; 67 uint32_t web_session_id_size) = 0;
68 virtual void TimerExpired(void* context) = 0; 68 virtual void TimerExpired(void* context) = 0;
69 virtual cdm::Status Decrypt(const cdm::InputBuffer& encrypted_buffer, 69 virtual cdm::Status Decrypt(const cdm::InputBuffer& encrypted_buffer,
70 cdm::DecryptedBlock* decrypted_buffer) = 0; 70 cdm::DecryptedBlock* decrypted_buffer) = 0;
71 virtual cdm::Status InitializeAudioDecoder( 71 virtual cdm::Status InitializeAudioDecoder(
72 const cdm::AudioDecoderConfig& audio_decoder_config) = 0; 72 const cdm::AudioDecoderConfig& audio_decoder_config) = 0;
73 virtual cdm::Status InitializeVideoDecoder( 73 virtual cdm::Status InitializeVideoDecoder(
74 const cdm::VideoDecoderConfig& video_decoder_config) = 0; 74 const cdm::VideoDecoderConfig& video_decoder_config) = 0;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 response_size); 219 response_size);
220 } 220 }
221 221
222 virtual bool GetUsableKeyIds(uint32_t promise_id, 222 virtual bool GetUsableKeyIds(uint32_t promise_id,
223 const char* web_session_id, 223 const char* web_session_id,
224 uint32_t web_session_id_size) OVERRIDE { 224 uint32_t web_session_id_size) OVERRIDE {
225 cdm_->GetUsableKeyIds(promise_id, web_session_id, web_session_id_size); 225 cdm_->GetUsableKeyIds(promise_id, web_session_id, web_session_id_size);
226 return true; 226 return true;
227 } 227 }
228 228
229 virtual void CloseSession(uint32_t promise_id, 229 virtual bool CloseSession(uint32_t promise_id,
230 const char* web_session_id, 230 const char* web_session_id,
231 uint32_t web_session_id_size) OVERRIDE { 231 uint32_t web_session_id_size) OVERRIDE {
232 cdm_->CloseSession(promise_id, web_session_id, web_session_id_size); 232 cdm_->CloseSession(promise_id, web_session_id, web_session_id_size);
233 return true;
233 } 234 }
234 235
235 virtual bool RemoveSession(uint32_t promise_id, 236 virtual void RemoveSession(uint32_t promise_id,
236 const char* web_session_id, 237 const char* web_session_id,
237 uint32_t web_session_id_size) OVERRIDE { 238 uint32_t web_session_id_size) OVERRIDE {
238 cdm_->RemoveSession(promise_id, web_session_id, web_session_id_size); 239 cdm_->RemoveSession(promise_id, web_session_id, web_session_id_size);
239 return true;
240 } 240 }
241 241
242 virtual void TimerExpired(void* context) OVERRIDE { 242 virtual void TimerExpired(void* context) OVERRIDE {
243 cdm_->TimerExpired(context); 243 cdm_->TimerExpired(context);
244 } 244 }
245 245
246 virtual cdm::Status Decrypt(const cdm::InputBuffer& encrypted_buffer, 246 virtual cdm::Status Decrypt(const cdm::InputBuffer& encrypted_buffer,
247 cdm::DecryptedBlock* decrypted_buffer) OVERRIDE { 247 cdm::DecryptedBlock* decrypted_buffer) OVERRIDE {
248 return cdm_->Decrypt(encrypted_buffer, decrypted_buffer); 248 return cdm_->Decrypt(encrypted_buffer, decrypted_buffer);
249 } 249 }
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 uint32_t session_id = LookupSessionId(web_session_str); 447 uint32_t session_id = LookupSessionId(web_session_str);
448 RegisterPromise(session_id, promise_id); 448 RegisterPromise(session_id, promise_id);
449 // As CDM_4 doesn't support OnSessionUsableKeysChange(), make sure to generate 449 // As CDM_4 doesn't support OnSessionUsableKeysChange(), make sure to generate
450 // one when the promise is resolved. This may be overly aggressive. 450 // one when the promise is resolved. This may be overly aggressive.
451 SetSessionUsableKeysEventNeeded( 451 SetSessionUsableKeysEventNeeded(
452 promise_id, web_session_id, web_session_id_size); 452 promise_id, web_session_id, web_session_id_size);
453 cdm_->UpdateSession(session_id, response, response_size); 453 cdm_->UpdateSession(session_id, response, response_size);
454 } 454 }
455 455
456 template <> 456 template <>
457 void CdmWrapperImpl<cdm::ContentDecryptionModule_4>::CloseSession( 457 bool CdmWrapperImpl<cdm::ContentDecryptionModule_4>::CloseSession(
458 uint32_t promise_id,
459 const char* web_session_id,
460 uint32_t web_session_id_size) {
461 return false;
462 }
463
464 template <>
465 void CdmWrapperImpl<cdm::ContentDecryptionModule_4>::RemoveSession(
458 uint32_t promise_id, 466 uint32_t promise_id,
459 const char* web_session_id, 467 const char* web_session_id,
460 uint32_t web_session_id_size) { 468 uint32_t web_session_id_size) {
461 std::string web_session_str(web_session_id, web_session_id_size); 469 std::string web_session_str(web_session_id, web_session_id_size);
462 uint32_t session_id = LookupSessionId(web_session_str); 470 uint32_t session_id = LookupSessionId(web_session_str);
463 RegisterPromise(session_id, promise_id); 471 RegisterPromise(session_id, promise_id);
464 cdm_->ReleaseSession(session_id); 472 cdm_->ReleaseSession(session_id);
465 } 473 }
xhwang 2014/08/23 00:01:48 ditto about order swap
jrummell 2014/08/23 00:27:15 CDM6 (and the EME spec) have CloseSession() first,
466 474
467 template <> 475 template <>
468 bool CdmWrapperImpl<cdm::ContentDecryptionModule_4>::RemoveSession(
469 uint32_t promise_id,
470 const char* web_session_id,
471 uint32_t web_session_id_size) {
472 return false;
473 }
474
475 template <>
476 bool CdmWrapperImpl<cdm::ContentDecryptionModule_4>::GetUsableKeyIds( 476 bool CdmWrapperImpl<cdm::ContentDecryptionModule_4>::GetUsableKeyIds(
477 uint32_t promise_id, 477 uint32_t promise_id,
478 const char* web_session_id, 478 const char* web_session_id,
479 uint32_t web_session_id_size) { 479 uint32_t web_session_id_size) {
480 return false; 480 return false;
481 } 481 }
482 482
483 template <> 483 template <>
484 cdm::Status CdmWrapperImpl<cdm::ContentDecryptionModule_4>::Decrypt( 484 cdm::Status CdmWrapperImpl<cdm::ContentDecryptionModule_4>::Decrypt(
485 const cdm::InputBuffer& encrypted_buffer, 485 const cdm::InputBuffer& encrypted_buffer,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 uint32_t response_size) { 565 uint32_t response_size) {
566 // As CDM_5 doesn't support OnSessionUsableKeysChange(), make sure to generate 566 // As CDM_5 doesn't support OnSessionUsableKeysChange(), make sure to generate
567 // one when the promise is resolved. This may be overly aggressive. 567 // one when the promise is resolved. This may be overly aggressive.
568 SetSessionUsableKeysEventNeeded( 568 SetSessionUsableKeysEventNeeded(
569 promise_id, web_session_id, web_session_id_size); 569 promise_id, web_session_id, web_session_id_size);
570 cdm_->UpdateSession( 570 cdm_->UpdateSession(
571 promise_id, web_session_id, web_session_id_size, response, response_size); 571 promise_id, web_session_id, web_session_id_size, response, response_size);
572 } 572 }
573 573
574 template <> 574 template <>
575 void CdmWrapperImpl<cdm::ContentDecryptionModule_5>::CloseSession( 575 bool CdmWrapperImpl<cdm::ContentDecryptionModule_5>::CloseSession(
576 uint32_t promise_id,
577 const char* web_session_id,
578 uint32_t web_session_id_size) {
579 return false;
580 }
581
582 template <>
583 void CdmWrapperImpl<cdm::ContentDecryptionModule_5>::RemoveSession(
xhwang 2014/08/23 00:01:48 It might be easier if we just drop CDM5 support :)
jrummell 2014/08/23 00:27:15 Acknowledged. That would just make this change big
576 uint32_t promise_id, 584 uint32_t promise_id,
577 const char* web_session_id, 585 const char* web_session_id,
578 uint32_t web_session_id_size) { 586 uint32_t web_session_id_size) {
579 cdm_->ReleaseSession(promise_id, web_session_id, web_session_id_size); 587 cdm_->ReleaseSession(promise_id, web_session_id, web_session_id_size);
580 } 588 }
581 589
582 template <> 590 template <>
583 bool CdmWrapperImpl<cdm::ContentDecryptionModule_5>::RemoveSession(
584 uint32_t promise_id,
585 const char* web_session_id,
586 uint32_t web_session_id_size) {
587 return false;
588 }
589
590 template <>
591 bool CdmWrapperImpl<cdm::ContentDecryptionModule_5>::GetUsableKeyIds( 591 bool CdmWrapperImpl<cdm::ContentDecryptionModule_5>::GetUsableKeyIds(
592 uint32_t promise_id, 592 uint32_t promise_id,
593 const char* web_session_id, 593 const char* web_session_id,
594 uint32_t web_session_id_size) { 594 uint32_t web_session_id_size) {
595 return false; 595 return false;
596 } 596 }
597 597
598 template <> 598 template <>
599 cdm::Status CdmWrapperImpl<cdm::ContentDecryptionModule_5>::Decrypt( 599 cdm::Status CdmWrapperImpl<cdm::ContentDecryptionModule_5>::Decrypt(
600 const cdm::InputBuffer& encrypted_buffer, 600 const cdm::InputBuffer& encrypted_buffer,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 // stub implementations for new or modified methods that the older CDM interface 668 // stub implementations for new or modified methods that the older CDM interface
669 // does not have. 669 // does not have.
670 // Also update supported_cdm_versions.h. 670 // Also update supported_cdm_versions.h.
671 COMPILE_ASSERT(cdm::ContentDecryptionModule::kVersion == 671 COMPILE_ASSERT(cdm::ContentDecryptionModule::kVersion ==
672 cdm::ContentDecryptionModule_6::kVersion, 672 cdm::ContentDecryptionModule_6::kVersion,
673 ensure_cdm_wrapper_templates_have_old_version_support); 673 ensure_cdm_wrapper_templates_have_old_version_support);
674 674
675 } // namespace media 675 } // namespace media
676 676
677 #endif // MEDIA_CDM_PPAPI_CDM_WRAPPER_H_ 677 #endif // MEDIA_CDM_PPAPI_CDM_WRAPPER_H_
OLDNEW
« media/cdm/ppapi/cdm_adapter.cc ('K') | « media/cdm/ppapi/cdm_adapter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698