cdm_wrapper.h revision f8ee788a64d60abd8f2d742a5fdedde054ecd910
18bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 28bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 38bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// found in the LICENSE file. 48bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 58bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#ifndef MEDIA_CDM_PPAPI_CDM_WRAPPER_H_ 68bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#define MEDIA_CDM_PPAPI_CDM_WRAPPER_H_ 78bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 8f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include <map> 9f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include <queue> 10f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include <string> 11f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 128bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "base/basictypes.h" 138bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "media/cdm/ppapi/api/content_decryption_module.h" 148bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "media/cdm/ppapi/cdm_helpers.h" 150f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)#include "media/cdm/ppapi/supported_cdm_versions.h" 168bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "ppapi/cpp/logging.h" 178bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 188bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)namespace media { 198bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 208bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// CdmWrapper wraps different versions of ContentDecryptionModule interfaces and 218bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// exposes a common interface to the caller. 228bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// 238bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// The caller should call CdmWrapper::Create() to create a CDM instance. 248bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// CdmWrapper will first try to create a CDM instance that supports the latest 258bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// CDM interface (ContentDecryptionModule). If such an instance cannot be 268bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// created (e.g. an older CDM was loaded), CdmWrapper will try to create a CDM 278bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// that supports an older version of CDM interface (e.g. 288bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// ContentDecryptionModule_*). Internally CdmWrapper converts the CdmWrapper 298bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// calls to corresponding ContentDecryptionModule calls. 308bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// 318bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// Note that CdmWrapper interface always reflects the latest state of content 328bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// decryption related PPAPI APIs (e.g. pp::ContentDecryptor_Private). 338bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// 348bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// Since this file is highly templated and default implementations are short 358bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// (just a shim layer in most cases), everything is done in this header file. 368bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)class CdmWrapper { 378bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) public: 388bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) static CdmWrapper* Create(const char* key_system, 391e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) uint32_t key_system_size, 408bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) GetCdmHostFunc get_cdm_host_func, 418bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) void* user_data); 428bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 438bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual ~CdmWrapper() {}; 448bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 45f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) virtual void CreateSession(uint32_t promise_id, 46f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) const char* init_data_type, 47f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t init_data_type_size, 48a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) const uint8_t* init_data, 49f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t init_data_size, 50f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) cdm::SessionType session_type) = 0; 51f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) virtual void LoadSession(uint32_t promise_id, 525d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const char* web_session_id, 535d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) uint32_t web_session_id_size) = 0; 54f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) virtual void UpdateSession(uint32_t promise_id, 55f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) const char* web_session_id, 56f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t web_session_id_size, 57c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch const uint8_t* response, 58c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch uint32_t response_size) = 0; 59f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) virtual void ReleaseSession(uint32_t promise_id, 60f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) const char* web_session_id, 61f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t web_session_id_size) = 0; 628bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual void TimerExpired(void* context) = 0; 638bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual cdm::Status Decrypt(const cdm::InputBuffer& encrypted_buffer, 648bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) cdm::DecryptedBlock* decrypted_buffer) = 0; 658bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual cdm::Status InitializeAudioDecoder( 668bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) const cdm::AudioDecoderConfig& audio_decoder_config) = 0; 678bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual cdm::Status InitializeVideoDecoder( 688bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) const cdm::VideoDecoderConfig& video_decoder_config) = 0; 698bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual void DeinitializeDecoder(cdm::StreamType decoder_type) = 0; 708bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual void ResetDecoder(cdm::StreamType decoder_type) = 0; 718bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual cdm::Status DecryptAndDecodeFrame( 728bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) const cdm::InputBuffer& encrypted_buffer, 738bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) cdm::VideoFrame* video_frame) = 0; 748bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual cdm::Status DecryptAndDecodeSamples( 758bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) const cdm::InputBuffer& encrypted_buffer, 768bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) cdm::AudioFrames* audio_frames) = 0; 778bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual void OnPlatformChallengeResponse( 788bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) const cdm::PlatformChallengeResponse& response) = 0; 798bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual void OnQueryOutputProtectionStatus( 808bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) uint32_t link_mask, 818bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) uint32_t output_protection_mask) = 0; 828bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 83f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) // Helper function for the cdm::Host_4 methods. Calls to CreateSession(), 84f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) // LoadSession(), UpdateSession(), and ReleaseSession() pass in promise ids, 85f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) // but the CDM interface needs session ids. For create and load, we need to 86f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) // create a new session_id to pass to the CDM. For update and release, we need 87f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) // to look up |web_session_id| and convert it into the existing |session_id|. 88f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) // Since the callbacks don't come through this interface, cdm_adapter needs to 89f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) // create the mapping (and delete it on release). 90f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) // TODO(jrummell): Remove these once Host_4 interface is removed. 91f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) virtual uint32_t LookupPromiseId(uint32_t session_id) = 0; 92f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) virtual void AssignWebSessionId(uint32_t session_id, 93f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) const char* web_session_id, 94f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t web_session_id_size) = 0; 95f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) virtual std::string LookupWebSessionId(uint32_t session_id) = 0; 96f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) virtual void DropWebSessionId(std::string web_session_id) = 0; 97f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) 98a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) protected: 99c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch CdmWrapper() {} 1008bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 1018bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) private: 1028bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(CdmWrapper); 1038bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)}; 1048bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 1058bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// Template class that does the CdmWrapper -> CdmInterface conversion. Default 1068bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// implementations are provided. Any methods that need special treatment should 1078bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// be specialized. 1088bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)template <class CdmInterface> 1098bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)class CdmWrapperImpl : public CdmWrapper { 1108bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) public: 1118bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) static CdmWrapper* Create(const char* key_system, 1121e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) uint32_t key_system_size, 1138bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) GetCdmHostFunc get_cdm_host_func, 1148bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) void* user_data) { 1158bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) void* cdm_instance = ::CreateCdmInstance( 1168bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) CdmInterface::kVersion, key_system, key_system_size, get_cdm_host_func, 1178bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) user_data); 1188bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) if (!cdm_instance) 1198bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) return NULL; 1208bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 1218bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) return new CdmWrapperImpl<CdmInterface>( 1228bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) static_cast<CdmInterface*>(cdm_instance)); 1238bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) } 1248bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 1258bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual ~CdmWrapperImpl() { 1268bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) cdm_->Destroy(); 1278bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) } 1288bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 129f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) virtual void CreateSession(uint32_t promise_id, 130f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) const char* init_data_type, 131f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t init_data_type_size, 132a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) const uint8_t* init_data, 133f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t init_data_size, 134f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) cdm::SessionType session_type) OVERRIDE { 135f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) cdm_->CreateSession(promise_id, 136f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) init_data_type, 137f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) init_data_type_size, 138f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) init_data, 139f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) init_data_size, 140f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) session_type); 1415d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) } 1425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 143f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) virtual void LoadSession(uint32_t promise_id, 1445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const char* web_session_id, 1455d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) uint32_t web_session_id_size) OVERRIDE { 146f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) cdm_->LoadSession(promise_id, web_session_id, web_session_id_size); 1478bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) } 1488bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 149f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) virtual void UpdateSession(uint32_t promise_id, 150f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) const char* web_session_id, 151f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t web_session_id_size, 152c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch const uint8_t* response, 153c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch uint32_t response_size) OVERRIDE { 154f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) cdm_->UpdateSession(promise_id, 155f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) web_session_id, 156f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) web_session_id_size, 157f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) response, 158f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) response_size); 1598bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) } 1608bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 161f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) virtual void ReleaseSession(uint32_t promise_id, 162f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) const char* web_session_id, 163f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t web_session_id_size) OVERRIDE { 164f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) cdm_->ReleaseSession(promise_id, web_session_id, web_session_id_size); 1658bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) } 1668bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 1678bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual void TimerExpired(void* context) OVERRIDE { 1688bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) cdm_->TimerExpired(context); 1698bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) } 1708bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 1718bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual cdm::Status Decrypt(const cdm::InputBuffer& encrypted_buffer, 1728bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) cdm::DecryptedBlock* decrypted_buffer) OVERRIDE { 1738bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) return cdm_->Decrypt(encrypted_buffer, decrypted_buffer); 1748bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) } 1758bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 1768bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual cdm::Status InitializeAudioDecoder( 1778bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) const cdm::AudioDecoderConfig& audio_decoder_config) OVERRIDE { 1788bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) return cdm_->InitializeAudioDecoder(audio_decoder_config); 1798bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) } 1808bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 1818bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual cdm::Status InitializeVideoDecoder( 1828bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) const cdm::VideoDecoderConfig& video_decoder_config) OVERRIDE { 1838bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) return cdm_->InitializeVideoDecoder(video_decoder_config); 1848bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) } 1858bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 1868bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual void DeinitializeDecoder(cdm::StreamType decoder_type) OVERRIDE { 1878bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) cdm_->DeinitializeDecoder(decoder_type); 1888bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) } 1898bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 1908bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual void ResetDecoder(cdm::StreamType decoder_type) OVERRIDE { 1918bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) cdm_->ResetDecoder(decoder_type); 1928bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) } 1938bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 1948bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual cdm::Status DecryptAndDecodeFrame( 1958bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) const cdm::InputBuffer& encrypted_buffer, 1968bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) cdm::VideoFrame* video_frame) OVERRIDE { 1978bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) return cdm_->DecryptAndDecodeFrame(encrypted_buffer, video_frame); 1988bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) } 1998bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 2008bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual cdm::Status DecryptAndDecodeSamples( 2018bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) const cdm::InputBuffer& encrypted_buffer, 2028bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) cdm::AudioFrames* audio_frames) OVERRIDE { 2038bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) return cdm_->DecryptAndDecodeSamples(encrypted_buffer, audio_frames); 2048bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) } 2058bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 2068bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual void OnPlatformChallengeResponse( 2078bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) const cdm::PlatformChallengeResponse& response) OVERRIDE { 2088bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) cdm_->OnPlatformChallengeResponse(response); 2098bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) } 2108bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 2118bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual void OnQueryOutputProtectionStatus( 2128bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) uint32_t link_mask, 2138bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) uint32_t output_protection_mask) OVERRIDE { 2148bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) cdm_->OnQueryOutputProtectionStatus(link_mask, output_protection_mask); 2158bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) } 2168bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 217f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t CreateSessionId() { 218f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) return next_session_id_++; 219f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) } 220f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) 221f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) void RegisterPromise(uint32_t session_id, uint32_t promise_id) { 222f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) PP_DCHECK(promise_to_session_id_map_.find(session_id) == 223f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) promise_to_session_id_map_.end()); 224f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) promise_to_session_id_map_.insert(std::make_pair(session_id, promise_id)); 225f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) } 226f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) 227f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) virtual uint32_t LookupPromiseId(uint32_t session_id) { 228f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) std::map<uint32_t, uint32_t>::iterator it = 229f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) promise_to_session_id_map_.find(session_id); 230f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) if (it == promise_to_session_id_map_.end()) 231f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) return 0; 232f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t promise_id = it->second; 233f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) promise_to_session_id_map_.erase(it); 234f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) return promise_id; 235f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) } 236f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) 237f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) virtual void AssignWebSessionId(uint32_t session_id, 238f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) const char* web_session_id, 239f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t web_session_id_size) { 240f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) web_session_to_session_id_map_.insert(std::make_pair( 241f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) std::string(web_session_id, web_session_id_size), session_id)); 242f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) } 243f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) 244f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t LookupSessionId(std::string web_session_id) { 245f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) return web_session_to_session_id_map_.find(web_session_id)->second; 246f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) } 247f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) 248f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) virtual std::string LookupWebSessionId(uint32_t session_id) { 249f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) std::map<std::string, uint32_t>::iterator it; 250f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) for (it = web_session_to_session_id_map_.begin(); 251f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) it != web_session_to_session_id_map_.end(); 252f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) ++it) { 253f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) if (it->second == session_id) 254f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) return it->first; 255f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) } 256f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) PP_NOTREACHED(); 257f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) return std::string(); 258f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) } 259f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) 260f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) virtual void DropWebSessionId(std::string web_session_id) { 261f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) web_session_to_session_id_map_.erase(web_session_id); 262f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) } 263f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) 2648bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) private: 265f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) CdmWrapperImpl(CdmInterface* cdm) : cdm_(cdm), next_session_id_(100) { 2668bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) PP_DCHECK(cdm_); 2678bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) } 2688bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 2698bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) CdmInterface* cdm_; 2708bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 271f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) std::map<uint32_t, uint32_t> promise_to_session_id_map_; 272f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t next_session_id_; 273f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) std::map<std::string, uint32_t> web_session_to_session_id_map_; 274f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) 2758bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(CdmWrapperImpl); 2768bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)}; 2778bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 278f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)// Overrides for the cdm::Host_4 methods. Calls to CreateSession(), 279f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)// LoadSession(), UpdateSession(), and ReleaseSession() pass in promise ids, 280f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)// but the CDM interface needs session ids. For create and load, we need to 281f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)// create a new session_id to pass to the CDM. For update and release, we need 282f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)// to look up |web_session_id| and convert it into the existing |session_id|. 283f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)// Since the callbacks don't come through this interface, cdm_adapter needs to 284f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)// create the mapping (and delete it on release). 285f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)// TODO(jrummell): Remove these once Host_4 interface is removed. 286f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) 287f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)template <> 288f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)void CdmWrapperImpl<cdm::ContentDecryptionModule_4>::CreateSession( 289f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t promise_id, 290f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) const char* init_data_type, 291f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t init_data_type_size, 292f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) const uint8_t* init_data, 293f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t init_data_size, 294f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) cdm::SessionType session_type) { 295f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t session_id = CreateSessionId(); 296f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) RegisterPromise(session_id, promise_id); 297f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) cdm_->CreateSession(session_id, 298f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) init_data_type, 299f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) init_data_type_size, 300f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) init_data, 301f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) init_data_size); 302f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)} 303f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) 304f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)template <> 305f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)void CdmWrapperImpl<cdm::ContentDecryptionModule_4>::LoadSession( 306f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t promise_id, 307f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) const char* web_session_id, 308f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t web_session_id_size) { 309f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t session_id = CreateSessionId(); 310f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) RegisterPromise(session_id, promise_id); 311f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) cdm_->LoadSession(session_id, web_session_id, web_session_id_size); 312f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)} 313f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) 314f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)template <> 315f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)void CdmWrapperImpl<cdm::ContentDecryptionModule_4>::UpdateSession( 316f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t promise_id, 317f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) const char* web_session_id, 318f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t web_session_id_size, 319f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) const uint8_t* response, 320f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t response_size) { 321f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) std::string web_session_str(web_session_id, web_session_id_size); 322f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t session_id = LookupSessionId(web_session_str); 323f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) RegisterPromise(session_id, promise_id); 324f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) cdm_->UpdateSession(session_id, response, response_size); 325f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)} 326f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) 327f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)template <> 328f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)void CdmWrapperImpl<cdm::ContentDecryptionModule_4>::ReleaseSession( 329f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t promise_id, 330f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) const char* web_session_id, 331f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t web_session_id_size) { 332f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) std::string web_session_str(web_session_id, web_session_id_size); 333f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) uint32_t session_id = LookupSessionId(web_session_str); 334f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) RegisterPromise(session_id, promise_id); 335f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) cdm_->ReleaseSession(session_id); 336f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)} 337f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) 3388bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)CdmWrapper* CdmWrapper::Create(const char* key_system, 3391e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) uint32_t key_system_size, 3408bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) GetCdmHostFunc get_cdm_host_func, 3418bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) void* user_data) { 3420f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) COMPILE_ASSERT(cdm::ContentDecryptionModule::kVersion == 343f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) cdm::ContentDecryptionModule_5::kVersion, 3440f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) update_code_below); 3450f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) 3465d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Ensure IsSupportedCdmInterfaceVersion() matches this implementation. 3470f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) // Always update this DCHECK when updating this function. 3480f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) // If this check fails, update this function and DCHECK or update 3495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // IsSupportedCdmInterfaceVersion(). 3500f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) PP_DCHECK( 351c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch !IsSupportedCdmInterfaceVersion(cdm::ContentDecryptionModule::kVersion + 352c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch 1) && 3530f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) IsSupportedCdmInterfaceVersion(cdm::ContentDecryptionModule::kVersion) && 354f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) IsSupportedCdmInterfaceVersion( 355f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) cdm::ContentDecryptionModule_4::kVersion) && 356f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) !IsSupportedCdmInterfaceVersion(cdm::ContentDecryptionModule_4::kVersion - 357c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch 1)); 3580f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) 3598bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) // Try to create the CDM using the latest CDM interface version. 3600f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) CdmWrapper* cdm_wrapper = 3618bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) CdmWrapperImpl<cdm::ContentDecryptionModule>::Create( 3628bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) key_system, key_system_size, get_cdm_host_func, user_data); 363f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) if (cdm_wrapper) 364f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) return cdm_wrapper; 3658bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 366c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch // If |cdm_wrapper| is NULL, try to create the CDM using older supported 367c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch // versions of the CDM interface. 368f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) cdm_wrapper = CdmWrapperImpl<cdm::ContentDecryptionModule_4>::Create( 369f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) key_system, key_system_size, get_cdm_host_func, user_data); 3700f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) return cdm_wrapper; 3718bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)} 3728bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 3738bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// When updating the CdmAdapter, ensure you've updated the CdmWrapper to contain 3741e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// stub implementations for new or modified methods that the older CDM interface 3751e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// does not have. 3760f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)// Also update supported_cdm_versions.h. 3771e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)COMPILE_ASSERT(cdm::ContentDecryptionModule::kVersion == 378f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) cdm::ContentDecryptionModule_5::kVersion, 3798bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) ensure_cdm_wrapper_templates_have_old_version_support); 3808bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 3818bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)} // namespace media 3828bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 3838bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#endif // MEDIA_CDM_PPAPI_CDM_WRAPPER_H_ 384