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

Side by Side Diff: media/cdm/ppapi/cdm_adapter.cc

Issue 26155003: Add CdmWrapper to support multiple CDM versions in CdmAdapter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase only Created 7 years, 2 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
« no previous file with comments | « media/cdm/ppapi/cdm_adapter.h ('k') | media/cdm/ppapi/cdm_wrapper.h » ('j') | 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 #include "media/cdm/ppapi/cdm_adapter.h" 5 #include "media/cdm/ppapi/cdm_adapter.h"
6 6
7 #include <cstring> 7 #include <cstring>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 namespace media { 205 namespace media {
206 206
207 CdmAdapter::CdmAdapter(PP_Instance instance, pp::Module* module) 207 CdmAdapter::CdmAdapter(PP_Instance instance, pp::Module* module)
208 : pp::Instance(instance), 208 : pp::Instance(instance),
209 pp::ContentDecryptor_Private(this), 209 pp::ContentDecryptor_Private(this),
210 allocator_(this), 210 allocator_(this),
211 cdm_(NULL) { 211 cdm_(NULL) {
212 callback_factory_.Initialize(this); 212 callback_factory_.Initialize(this);
213 } 213 }
214 214
215 CdmAdapter::~CdmAdapter() { 215 CdmAdapter::~CdmAdapter() {}
216 if (cdm_)
217 cdm_->Destroy();
218 }
219 216
220 bool CdmAdapter::CreateCdmInstance(const std::string& key_system) { 217 bool CdmAdapter::CreateCdmInstance(const std::string& key_system) {
221 PP_DCHECK(!cdm_); 218 PP_DCHECK(!cdm_);
222 cdm_ = static_cast<cdm::ContentDecryptionModule*>( 219 cdm_ = make_linked_ptr(CdmWrapper::Create(
223 ::CreateCdmInstance(cdm::kCdmInterfaceVersion, 220 key_system.data(), key_system.size(), GetCdmHost, this));
224 key_system.data(), key_system.size(),
225 GetCdmHost, this));
226
227 return (cdm_ != NULL); 221 return (cdm_ != NULL);
228 } 222 }
229 223
230 // No KeyErrors should be reported in this function because they cannot be 224 // No KeyErrors should be reported in this function because they cannot be
231 // bubbled up in the WD EME API. Those errors will be reported during session 225 // bubbled up in the WD EME API. Those errors will be reported during session
232 // creation (aka GenerateKeyRequest). 226 // creation (aka GenerateKeyRequest).
233 void CdmAdapter::Initialize(const std::string& key_system, 227 void CdmAdapter::Initialize(const std::string& key_system,
234 bool can_challenge_platform) { 228 bool can_challenge_platform) {
235 PP_DCHECK(!key_system.empty()); 229 PP_DCHECK(!key_system.empty());
236 PP_DCHECK(key_system_.empty() || (key_system_ == key_system && cdm_)); 230 PP_DCHECK(key_system_.empty() || (key_system_ == key_system && cdm_));
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 } // namespace media 769 } // namespace media
776 770
777 namespace pp { 771 namespace pp {
778 772
779 // Factory function for your specialization of the Module object. 773 // Factory function for your specialization of the Module object.
780 Module* CreateModule() { 774 Module* CreateModule() {
781 return new media::CdmAdapterModule(); 775 return new media::CdmAdapterModule();
782 } 776 }
783 777
784 } // namespace pp 778 } // namespace pp
OLDNEW
« no previous file with comments | « media/cdm/ppapi/cdm_adapter.h ('k') | media/cdm/ppapi/cdm_wrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698