OLD | NEW |
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/ppapi_cdm_adapter.h" | 5 #include "media/cdm/ppapi/ppapi_cdm_adapter.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 // The Pepper plugin will be staticly linked to the CDM, so pass the plugin's | 348 // The Pepper plugin will be staticly linked to the CDM, so pass the plugin's |
349 // CreateCdmInstance() to CdmWrapper. | 349 // CreateCdmInstance() to CdmWrapper. |
350 CdmWrapper* cdm = CdmWrapper::Create(::CreateCdmInstance, key_system.data(), | 350 CdmWrapper* cdm = CdmWrapper::Create(::CreateCdmInstance, key_system.data(), |
351 key_system.size(), GetCdmHost, this); | 351 key_system.size(), GetCdmHost, this); |
352 | 352 |
353 const std::string message = "CDM instance for " + key_system + | 353 const std::string message = "CDM instance for " + key_system + |
354 (cdm ? "" : " could not be") + " created."; | 354 (cdm ? "" : " could not be") + " created."; |
355 DLOG_TO_CONSOLE(message); | 355 DLOG_TO_CONSOLE(message); |
356 CDM_DLOG() << message; | 356 CDM_DLOG() << message; |
357 | 357 |
| 358 if (cdm) { |
| 359 pp::UMAPrivate uma_interface(this); |
| 360 |
| 361 // The interface version is relatively small. So using normal histogram |
| 362 // instead of a sparse histogram is okay. The following DCHECK asserts this. |
| 363 PP_DCHECK(cdm->GetInterfaceVersion() <= 30); |
| 364 uma_interface.HistogramEnumeration( |
| 365 "Media.EME.CdmInterfaceVersion", cdm->GetInterfaceVersion(), |
| 366 // Sample value should always be less than the boundary. Hence use "+1". |
| 367 // See the comment on HistogramEnumeration in ppb_uma_private.idl. |
| 368 cdm::ContentDecryptionModule::kVersion + 1); |
| 369 } |
| 370 |
358 return cdm; | 371 return cdm; |
359 } | 372 } |
360 | 373 |
361 void PpapiCdmAdapter::Initialize(uint32_t promise_id, | 374 void PpapiCdmAdapter::Initialize(uint32_t promise_id, |
362 const std::string& key_system, | 375 const std::string& key_system, |
363 bool allow_distinctive_identifier, | 376 bool allow_distinctive_identifier, |
364 bool allow_persistent_state) { | 377 bool allow_persistent_state) { |
365 PP_DCHECK(!key_system.empty()); | 378 PP_DCHECK(!key_system.empty()); |
366 PP_DCHECK(!cdm_); | 379 PP_DCHECK(!cdm_); |
367 | 380 |
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1313 } // namespace media | 1326 } // namespace media |
1314 | 1327 |
1315 namespace pp { | 1328 namespace pp { |
1316 | 1329 |
1317 // Factory function for your specialization of the Module object. | 1330 // Factory function for your specialization of the Module object. |
1318 Module* CreateModule() { | 1331 Module* CreateModule() { |
1319 return new media::PpapiCdmAdapterModule(); | 1332 return new media::PpapiCdmAdapterModule(); |
1320 } | 1333 } |
1321 | 1334 |
1322 } // namespace pp | 1335 } // namespace pp |
OLD | NEW |