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

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: reorder 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
« no previous file with comments | « media/cdm/ppapi/cdm_adapter.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // TODO(jrummell): Remove return value when CDM4/5 are removed.
60 virtual bool CloseSession(uint32_t promise_id,
60 const char* web_session_id, 61 const char* web_session_id,
61 uint32_t web_session_id_size) = 0; 62 uint32_t web_session_id_size) = 0;
62 virtual bool RemoveSession(uint32_t promise_id, 63 virtual void RemoveSession(uint32_t promise_id,
63 const char* web_session_id, 64 const char* web_session_id,
64 uint32_t web_session_id_size) = 0; 65 uint32_t web_session_id_size) = 0;
66 // TODO(jrummell): Remove return value when CDM4/5 are removed.
65 virtual bool GetUsableKeyIds(uint32_t promise_id, 67 virtual bool GetUsableKeyIds(uint32_t promise_id,
66 const char* web_session_id, 68 const char* web_session_id,
67 uint32_t web_session_id_size) = 0; 69 uint32_t web_session_id_size) = 0;
68 virtual void TimerExpired(void* context) = 0; 70 virtual void TimerExpired(void* context) = 0;
69 virtual cdm::Status Decrypt(const cdm::InputBuffer& encrypted_buffer, 71 virtual cdm::Status Decrypt(const cdm::InputBuffer& encrypted_buffer,
70 cdm::DecryptedBlock* decrypted_buffer) = 0; 72 cdm::DecryptedBlock* decrypted_buffer) = 0;
71 virtual cdm::Status InitializeAudioDecoder( 73 virtual cdm::Status InitializeAudioDecoder(
72 const cdm::AudioDecoderConfig& audio_decoder_config) = 0; 74 const cdm::AudioDecoderConfig& audio_decoder_config) = 0;
73 virtual cdm::Status InitializeVideoDecoder( 75 virtual cdm::Status InitializeVideoDecoder(
74 const cdm::VideoDecoderConfig& video_decoder_config) = 0; 76 const cdm::VideoDecoderConfig& video_decoder_config) = 0;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 response_size); 221 response_size);
220 } 222 }
221 223
222 virtual bool GetUsableKeyIds(uint32_t promise_id, 224 virtual bool GetUsableKeyIds(uint32_t promise_id,
223 const char* web_session_id, 225 const char* web_session_id,
224 uint32_t web_session_id_size) OVERRIDE { 226 uint32_t web_session_id_size) OVERRIDE {
225 cdm_->GetUsableKeyIds(promise_id, web_session_id, web_session_id_size); 227 cdm_->GetUsableKeyIds(promise_id, web_session_id, web_session_id_size);
226 return true; 228 return true;
227 } 229 }
228 230
229 virtual void CloseSession(uint32_t promise_id, 231 virtual bool CloseSession(uint32_t promise_id,
230 const char* web_session_id, 232 const char* web_session_id,
231 uint32_t web_session_id_size) OVERRIDE { 233 uint32_t web_session_id_size) OVERRIDE {
232 cdm_->CloseSession(promise_id, web_session_id, web_session_id_size); 234 cdm_->CloseSession(promise_id, web_session_id, web_session_id_size);
235 return true;
233 } 236 }
234 237
235 virtual bool RemoveSession(uint32_t promise_id, 238 virtual void RemoveSession(uint32_t promise_id,
236 const char* web_session_id, 239 const char* web_session_id,
237 uint32_t web_session_id_size) OVERRIDE { 240 uint32_t web_session_id_size) OVERRIDE {
238 cdm_->RemoveSession(promise_id, web_session_id, web_session_id_size); 241 cdm_->RemoveSession(promise_id, web_session_id, web_session_id_size);
239 return true;
240 } 242 }
241 243
242 virtual void TimerExpired(void* context) OVERRIDE { 244 virtual void TimerExpired(void* context) OVERRIDE {
243 cdm_->TimerExpired(context); 245 cdm_->TimerExpired(context);
244 } 246 }
245 247
246 virtual cdm::Status Decrypt(const cdm::InputBuffer& encrypted_buffer, 248 virtual cdm::Status Decrypt(const cdm::InputBuffer& encrypted_buffer,
247 cdm::DecryptedBlock* decrypted_buffer) OVERRIDE { 249 cdm::DecryptedBlock* decrypted_buffer) OVERRIDE {
248 return cdm_->Decrypt(encrypted_buffer, decrypted_buffer); 250 return cdm_->Decrypt(encrypted_buffer, decrypted_buffer);
249 } 251 }
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 uint32_t session_id = LookupSessionId(web_session_str); 449 uint32_t session_id = LookupSessionId(web_session_str);
448 RegisterPromise(session_id, promise_id); 450 RegisterPromise(session_id, promise_id);
449 // As CDM_4 doesn't support OnSessionUsableKeysChange(), make sure to generate 451 // As CDM_4 doesn't support OnSessionUsableKeysChange(), make sure to generate
450 // one when the promise is resolved. This may be overly aggressive. 452 // one when the promise is resolved. This may be overly aggressive.
451 SetSessionUsableKeysEventNeeded( 453 SetSessionUsableKeysEventNeeded(
452 promise_id, web_session_id, web_session_id_size); 454 promise_id, web_session_id, web_session_id_size);
453 cdm_->UpdateSession(session_id, response, response_size); 455 cdm_->UpdateSession(session_id, response, response_size);
454 } 456 }
455 457
456 template <> 458 template <>
457 void CdmWrapperImpl<cdm::ContentDecryptionModule_4>::CloseSession( 459 bool CdmWrapperImpl<cdm::ContentDecryptionModule_4>::CloseSession(
460 uint32_t promise_id,
461 const char* web_session_id,
462 uint32_t web_session_id_size) {
463 return false;
464 }
465
466 template <>
467 void CdmWrapperImpl<cdm::ContentDecryptionModule_4>::RemoveSession(
458 uint32_t promise_id, 468 uint32_t promise_id,
459 const char* web_session_id, 469 const char* web_session_id,
460 uint32_t web_session_id_size) { 470 uint32_t web_session_id_size) {
461 std::string web_session_str(web_session_id, web_session_id_size); 471 std::string web_session_str(web_session_id, web_session_id_size);
462 uint32_t session_id = LookupSessionId(web_session_str); 472 uint32_t session_id = LookupSessionId(web_session_str);
463 RegisterPromise(session_id, promise_id); 473 RegisterPromise(session_id, promise_id);
464 cdm_->ReleaseSession(session_id); 474 cdm_->ReleaseSession(session_id);
465 } 475 }
466 476
467 template <> 477 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( 478 bool CdmWrapperImpl<cdm::ContentDecryptionModule_4>::GetUsableKeyIds(
477 uint32_t promise_id, 479 uint32_t promise_id,
478 const char* web_session_id, 480 const char* web_session_id,
479 uint32_t web_session_id_size) { 481 uint32_t web_session_id_size) {
480 return false; 482 return false;
481 } 483 }
482 484
483 template <> 485 template <>
484 cdm::Status CdmWrapperImpl<cdm::ContentDecryptionModule_4>::Decrypt( 486 cdm::Status CdmWrapperImpl<cdm::ContentDecryptionModule_4>::Decrypt(
485 const cdm::InputBuffer& encrypted_buffer, 487 const cdm::InputBuffer& encrypted_buffer,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 uint32_t response_size) { 567 uint32_t response_size) {
566 // As CDM_5 doesn't support OnSessionUsableKeysChange(), make sure to generate 568 // As CDM_5 doesn't support OnSessionUsableKeysChange(), make sure to generate
567 // one when the promise is resolved. This may be overly aggressive. 569 // one when the promise is resolved. This may be overly aggressive.
568 SetSessionUsableKeysEventNeeded( 570 SetSessionUsableKeysEventNeeded(
569 promise_id, web_session_id, web_session_id_size); 571 promise_id, web_session_id, web_session_id_size);
570 cdm_->UpdateSession( 572 cdm_->UpdateSession(
571 promise_id, web_session_id, web_session_id_size, response, response_size); 573 promise_id, web_session_id, web_session_id_size, response, response_size);
572 } 574 }
573 575
574 template <> 576 template <>
575 void CdmWrapperImpl<cdm::ContentDecryptionModule_5>::CloseSession( 577 bool CdmWrapperImpl<cdm::ContentDecryptionModule_5>::CloseSession(
578 uint32_t promise_id,
579 const char* web_session_id,
580 uint32_t web_session_id_size) {
581 return false;
582 }
583
584 template <>
585 void CdmWrapperImpl<cdm::ContentDecryptionModule_5>::RemoveSession(
576 uint32_t promise_id, 586 uint32_t promise_id,
577 const char* web_session_id, 587 const char* web_session_id,
578 uint32_t web_session_id_size) { 588 uint32_t web_session_id_size) {
579 cdm_->ReleaseSession(promise_id, web_session_id, web_session_id_size); 589 cdm_->ReleaseSession(promise_id, web_session_id, web_session_id_size);
580 } 590 }
581 591
582 template <> 592 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( 593 bool CdmWrapperImpl<cdm::ContentDecryptionModule_5>::GetUsableKeyIds(
592 uint32_t promise_id, 594 uint32_t promise_id,
593 const char* web_session_id, 595 const char* web_session_id,
594 uint32_t web_session_id_size) { 596 uint32_t web_session_id_size) {
595 return false; 597 return false;
596 } 598 }
597 599
598 template <> 600 template <>
599 cdm::Status CdmWrapperImpl<cdm::ContentDecryptionModule_5>::Decrypt( 601 cdm::Status CdmWrapperImpl<cdm::ContentDecryptionModule_5>::Decrypt(
600 const cdm::InputBuffer& encrypted_buffer, 602 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 670 // stub implementations for new or modified methods that the older CDM interface
669 // does not have. 671 // does not have.
670 // Also update supported_cdm_versions.h. 672 // Also update supported_cdm_versions.h.
671 COMPILE_ASSERT(cdm::ContentDecryptionModule::kVersion == 673 COMPILE_ASSERT(cdm::ContentDecryptionModule::kVersion ==
672 cdm::ContentDecryptionModule_6::kVersion, 674 cdm::ContentDecryptionModule_6::kVersion,
673 ensure_cdm_wrapper_templates_have_old_version_support); 675 ensure_cdm_wrapper_templates_have_old_version_support);
674 676
675 } // namespace media 677 } // namespace media
676 678
677 #endif // MEDIA_CDM_PPAPI_CDM_WRAPPER_H_ 679 #endif // MEDIA_CDM_PPAPI_CDM_WRAPPER_H_
OLDNEW
« no previous file with comments | « media/cdm/ppapi/cdm_adapter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698