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

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

Issue 2265893003: media: Add UMA to report CDM interface version being used (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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_CDM_WRAPPER_H_ 5 #ifndef MEDIA_CDM_CDM_WRAPPER_H_
6 #define MEDIA_CDM_CDM_WRAPPER_H_ 6 #define MEDIA_CDM_CDM_WRAPPER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // Since this file is highly templated and default implementations are short 51 // Since this file is highly templated and default implementations are short
52 // (just a shim layer in most cases), everything is done in this header file. 52 // (just a shim layer in most cases), everything is done in this header file.
53 class CdmWrapper { 53 class CdmWrapper {
54 public: 54 public:
55 static CdmWrapper* Create(CreateCdmFunc create_cdm_func, 55 static CdmWrapper* Create(CreateCdmFunc create_cdm_func,
56 const char* key_system, 56 const char* key_system,
57 uint32_t key_system_size, 57 uint32_t key_system_size,
58 GetCdmHostFunc get_cdm_host_func, 58 GetCdmHostFunc get_cdm_host_func,
59 void* user_data); 59 void* user_data);
60 60
61 virtual ~CdmWrapper(){}; 61 virtual ~CdmWrapper() {}
62
63 // Returns the version of the CDM interface that the created CDM uses.
64 virtual int GetVersion() = 0;
ddorwin 2016/08/22 20:38:15 Get*API*Version or something like that. (In theory
xhwang 2016/08/23 00:21:43 Done.
62 65
63 virtual void Initialize(bool allow_distinctive_identifier, 66 virtual void Initialize(bool allow_distinctive_identifier,
64 bool allow_persistent_state) = 0; 67 bool allow_persistent_state) = 0;
65 virtual void SetServerCertificate(uint32_t promise_id, 68 virtual void SetServerCertificate(uint32_t promise_id,
66 const uint8_t* server_certificate_data, 69 const uint8_t* server_certificate_data,
67 uint32_t server_certificate_data_size) = 0; 70 uint32_t server_certificate_data_size) = 0;
68 virtual void CreateSessionAndGenerateRequest(uint32_t promise_id, 71 virtual void CreateSessionAndGenerateRequest(uint32_t promise_id,
69 cdm::SessionType session_type, 72 cdm::SessionType session_type,
70 cdm::InitDataType init_data_type, 73 cdm::InitDataType init_data_type,
71 const uint8_t* init_data, 74 const uint8_t* init_data,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 get_cdm_host_func, user_data); 133 get_cdm_host_func, user_data);
131 if (!cdm_instance) 134 if (!cdm_instance)
132 return nullptr; 135 return nullptr;
133 136
134 return new CdmWrapperImpl<CdmInterface>( 137 return new CdmWrapperImpl<CdmInterface>(
135 static_cast<CdmInterface*>(cdm_instance)); 138 static_cast<CdmInterface*>(cdm_instance));
136 } 139 }
137 140
138 ~CdmWrapperImpl() override { cdm_->Destroy(); } 141 ~CdmWrapperImpl() override { cdm_->Destroy(); }
139 142
143 int GetVersion() override { return CdmInterface::kVersion; }
144
140 void Initialize(bool allow_distinctive_identifier, 145 void Initialize(bool allow_distinctive_identifier,
141 bool allow_persistent_state) override { 146 bool allow_persistent_state) override {
142 cdm_->Initialize(allow_distinctive_identifier, allow_persistent_state); 147 cdm_->Initialize(allow_distinctive_identifier, allow_persistent_state);
143 } 148 }
144 149
145 void SetServerCertificate(uint32_t promise_id, 150 void SetServerCertificate(uint32_t promise_id,
146 const uint8_t* server_certificate_data, 151 const uint8_t* server_certificate_data,
147 uint32_t server_certificate_data_size) override { 152 uint32_t server_certificate_data_size) override {
148 cdm_->SetServerCertificate(promise_id, server_certificate_data, 153 cdm_->SetServerCertificate(promise_id, server_certificate_data,
149 server_certificate_data_size); 154 server_certificate_data_size);
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 // Also update supported_cdm_versions.h. 324 // Also update supported_cdm_versions.h.
320 static_assert(cdm::ContentDecryptionModule::kVersion == 325 static_assert(cdm::ContentDecryptionModule::kVersion ==
321 cdm::ContentDecryptionModule_8::kVersion, 326 cdm::ContentDecryptionModule_8::kVersion,
322 "ensure cdm wrapper templates have old version support"); 327 "ensure cdm wrapper templates have old version support");
323 328
324 } // namespace media 329 } // namespace media
325 330
326 #undef PLATFORM_DCHECK 331 #undef PLATFORM_DCHECK
327 332
328 #endif // MEDIA_CDM_CDM_WRAPPER_H_ 333 #endif // MEDIA_CDM_CDM_WRAPPER_H_
OLDNEW
« no previous file with comments | « no previous file | media/cdm/ppapi/ppapi_cdm_adapter.cc » ('j') | media/cdm/ppapi/ppapi_cdm_adapter.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698