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

Side by Side Diff: media/base/key_systems.cc

Issue 875073004: Don't update Media.EME.KeySystemSupport UMA for unprefixed EME (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move comment Created 5 years, 10 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/base/key_systems.h ('k') | media/base/key_systems_unittest.cc » ('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/base/key_systems.h" 5 #include "media/base/key_systems.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 bool IsSupportedKeySystem(const std::string& key_system); 114 bool IsSupportedKeySystem(const std::string& key_system);
115 115
116 bool IsSupportedKeySystemWithInitDataType( 116 bool IsSupportedKeySystemWithInitDataType(
117 const std::string& key_system, 117 const std::string& key_system,
118 const std::string& init_data_type); 118 const std::string& init_data_type);
119 119
120 bool IsSupportedKeySystemWithMediaMimeType( 120 bool IsSupportedKeySystemWithMediaMimeType(
121 const std::string& mime_type, 121 const std::string& mime_type,
122 const std::vector<std::string>& codecs, 122 const std::vector<std::string>& codecs,
123 const std::string& key_system); 123 const std::string& key_system,
124 bool reportToUma);
124 125
125 std::string GetKeySystemNameForUMA(const std::string& key_system) const; 126 std::string GetKeySystemNameForUMA(const std::string& key_system) const;
126 127
127 bool UseAesDecryptor(const std::string& concrete_key_system); 128 bool UseAesDecryptor(const std::string& concrete_key_system);
128 129
129 #if defined(ENABLE_PEPPER_CDMS) 130 #if defined(ENABLE_PEPPER_CDMS)
130 std::string GetPepperType(const std::string& concrete_key_system); 131 std::string GetPepperType(const std::string& concrete_key_system);
131 #endif 132 #endif
132 133
133 void AddContainerMask(const std::string& container, uint32 mask); 134 void AddContainerMask(const std::string& container, uint32 mask);
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 EmeInitDataType eme_init_data_type = GetInitDataTypeForName(init_data_type); 469 EmeInitDataType eme_init_data_type = GetInitDataTypeForName(init_data_type);
469 return (properties.supported_init_data_types & eme_init_data_type) != 0; 470 return (properties.supported_init_data_types & eme_init_data_type) != 0;
470 } 471 }
471 472
472 // TODO(sandersd): Reorganize to be more similar to 473 // TODO(sandersd): Reorganize to be more similar to
473 // IsKeySystemSupportedWithInitDataType(). Note that a fork may still be 474 // IsKeySystemSupportedWithInitDataType(). Note that a fork may still be
474 // required; http://crbug.com/417461. 475 // required; http://crbug.com/417461.
475 bool KeySystems::IsSupportedKeySystemWithMediaMimeType( 476 bool KeySystems::IsSupportedKeySystemWithMediaMimeType(
476 const std::string& mime_type, 477 const std::string& mime_type,
477 const std::vector<std::string>& codecs, 478 const std::vector<std::string>& codecs,
478 const std::string& key_system) { 479 const std::string& key_system,
480 bool reportToUma) {
479 DCHECK(thread_checker_.CalledOnValidThread()); 481 DCHECK(thread_checker_.CalledOnValidThread());
480 482
481 // If |key_system| is a parent key system, use its concrete child. 483 // If |key_system| is a parent key system, use its concrete child.
482 const std::string& concrete_key_system = GetConcreteKeySystemName(key_system); 484 const std::string& concrete_key_system = GetConcreteKeySystemName(key_system);
483 485
484 bool has_type = !mime_type.empty(); 486 bool has_type = !mime_type.empty();
485 487
486 key_systems_support_uma_.ReportKeySystemQuery(key_system, has_type); 488 if (reportToUma)
489 key_systems_support_uma_.ReportKeySystemQuery(key_system, has_type);
487 490
488 // Check key system support. 491 // Check key system support.
489 KeySystemPropertiesMap::const_iterator key_system_iter = 492 KeySystemPropertiesMap::const_iterator key_system_iter =
490 concrete_key_system_map_.find(concrete_key_system); 493 concrete_key_system_map_.find(concrete_key_system);
491 if (key_system_iter == concrete_key_system_map_.end()) 494 if (key_system_iter == concrete_key_system_map_.end())
492 return false; 495 return false;
493 496
494 key_systems_support_uma_.ReportKeySystemSupport(key_system, false); 497 if (reportToUma)
498 key_systems_support_uma_.ReportKeySystemSupport(key_system, false);
495 499
496 if (!has_type) { 500 if (!has_type) {
497 DCHECK(codecs.empty()); 501 DCHECK(codecs.empty());
498 return true; 502 return true;
499 } 503 }
500 504
501 SupportedCodecs key_system_supported_codecs = 505 SupportedCodecs key_system_supported_codecs =
502 key_system_iter->second.supported_codecs; 506 key_system_iter->second.supported_codecs;
503 507
504 if (!IsSupportedContainer(mime_type, key_system_supported_codecs)) 508 if (!IsSupportedContainer(mime_type, key_system_supported_codecs))
505 return false; 509 return false;
506 510
507 if (!codecs.empty() && 511 if (!codecs.empty() &&
508 !IsSupportedContainerAndCodecs( 512 !IsSupportedContainerAndCodecs(
509 mime_type, codecs, key_system_supported_codecs)) { 513 mime_type, codecs, key_system_supported_codecs)) {
510 return false; 514 return false;
511 } 515 }
512 516
513 key_systems_support_uma_.ReportKeySystemSupport(key_system, true); 517 if (reportToUma)
518 key_systems_support_uma_.ReportKeySystemSupport(key_system, true);
514 return true; 519 return true;
515 } 520 }
516 521
517 std::string KeySystems::GetKeySystemNameForUMA( 522 std::string KeySystems::GetKeySystemNameForUMA(
518 const std::string& key_system) const { 523 const std::string& key_system) const {
519 DCHECK(thread_checker_.CalledOnValidThread()); 524 DCHECK(thread_checker_.CalledOnValidThread());
520 525
521 KeySystemNameForUMAMap::const_iterator iter = 526 KeySystemNameForUMAMap::const_iterator iter =
522 key_system_name_for_uma_map_.find(key_system); 527 key_system_name_for_uma_map_.find(key_system);
523 if (iter == key_system_name_for_uma_map_.end()) 528 if (iter == key_system_name_for_uma_map_.end())
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 const std::string& init_data_type) { 619 const std::string& init_data_type) {
615 return KeySystems::GetInstance().IsSupportedKeySystemWithInitDataType( 620 return KeySystems::GetInstance().IsSupportedKeySystemWithInitDataType(
616 key_system, init_data_type); 621 key_system, init_data_type);
617 } 622 }
618 623
619 bool IsSupportedKeySystemWithMediaMimeType( 624 bool IsSupportedKeySystemWithMediaMimeType(
620 const std::string& mime_type, 625 const std::string& mime_type,
621 const std::vector<std::string>& codecs, 626 const std::vector<std::string>& codecs,
622 const std::string& key_system) { 627 const std::string& key_system) {
623 return KeySystems::GetInstance().IsSupportedKeySystemWithMediaMimeType( 628 return KeySystems::GetInstance().IsSupportedKeySystemWithMediaMimeType(
624 mime_type, codecs, key_system); 629 mime_type, codecs, key_system, false);
630 }
631
632 bool PrefixedIsSupportedKeySystemWithMediaMimeType(
633 const std::string& mime_type,
634 const std::vector<std::string>& codecs,
635 const std::string& key_system) {
636 return KeySystems::GetInstance().IsSupportedKeySystemWithMediaMimeType(
637 mime_type, codecs, key_system, true);
625 } 638 }
626 639
627 std::string GetKeySystemNameForUMA(const std::string& key_system) { 640 std::string GetKeySystemNameForUMA(const std::string& key_system) {
628 return KeySystems::GetInstance().GetKeySystemNameForUMA(key_system); 641 return KeySystems::GetInstance().GetKeySystemNameForUMA(key_system);
629 } 642 }
630 643
631 bool CanUseAesDecryptor(const std::string& concrete_key_system) { 644 bool CanUseAesDecryptor(const std::string& concrete_key_system) {
632 return KeySystems::GetInstance().UseAesDecryptor(concrete_key_system); 645 return KeySystems::GetInstance().UseAesDecryptor(concrete_key_system);
633 } 646 }
634 647
(...skipping 12 matching lines...) Expand all
647 MEDIA_EXPORT void AddContainerMask(const std::string& container, 660 MEDIA_EXPORT void AddContainerMask(const std::string& container,
648 uint32 mask) { 661 uint32 mask) {
649 KeySystems::GetInstance().AddContainerMask(container, mask); 662 KeySystems::GetInstance().AddContainerMask(container, mask);
650 } 663 }
651 664
652 MEDIA_EXPORT void AddCodecMask(const std::string& codec, uint32 mask) { 665 MEDIA_EXPORT void AddCodecMask(const std::string& codec, uint32 mask) {
653 KeySystems::GetInstance().AddCodecMask(codec, mask); 666 KeySystems::GetInstance().AddCodecMask(codec, mask);
654 } 667 }
655 668
656 } // namespace media 669 } // namespace media
OLDNEW
« no previous file with comments | « media/base/key_systems.h ('k') | media/base/key_systems_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698