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/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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 {"vp8.0", EME_CODEC_WEBM_VP8}, | 68 {"vp8.0", EME_CODEC_WEBM_VP8}, |
69 {"vp9", EME_CODEC_WEBM_VP9}, | 69 {"vp9", EME_CODEC_WEBM_VP9}, |
70 {"vp9.0", EME_CODEC_WEBM_VP9}, | 70 {"vp9.0", EME_CODEC_WEBM_VP9}, |
71 #if defined(USE_PROPRIETARY_CODECS) | 71 #if defined(USE_PROPRIETARY_CODECS) |
72 {"mp4a", EME_CODEC_MP4_AAC}, | 72 {"mp4a", EME_CODEC_MP4_AAC}, |
73 {"avc1", EME_CODEC_MP4_AVC1}, | 73 {"avc1", EME_CODEC_MP4_AVC1}, |
74 {"avc3", EME_CODEC_MP4_AVC1} | 74 {"avc3", EME_CODEC_MP4_AVC1} |
75 #endif // defined(USE_PROPRIETARY_CODECS) | 75 #endif // defined(USE_PROPRIETARY_CODECS) |
76 }; | 76 }; |
77 | 77 |
78 static EmeRequirementSupport ConvertSessionTypeSupport( | |
ddorwin
2015/03/13 19:24:47
Should we just eliminate EmeSessionTypeSupport?
sandersd (OOO until July 31)
2015/03/13 20:11:56
Probably. I really don't want to have an INVALID E
ddorwin
2015/03/16 23:25:07
Acknowledged.
We also have PERMISSION_PREFERRED,
| |
79 EmeSessionTypeSupport support) { | |
80 switch (support) { | |
81 case EME_SESSION_TYPE_INVALID: | |
82 NOTREACHED(); | |
83 return EME_REQUIREMENT_NOT_SUPPORTED; | |
84 case EME_SESSION_TYPE_NOT_SUPPORTED: | |
85 return EME_REQUIREMENT_NOT_SUPPORTED; | |
86 case EME_SESSION_TYPE_SUPPORTED_WITH_PERMISSION: | |
87 return EME_REQUIREMENT_SUPPORTED_WITH_PERMISSION; | |
88 case EME_SESSION_TYPE_SUPPORTED: | |
89 return EME_REQUIREMENT_SUPPORTED; | |
90 } | |
91 NOTREACHED(); | |
92 return EME_REQUIREMENT_NOT_SUPPORTED; | |
93 } | |
94 | |
78 static void AddClearKey(std::vector<KeySystemInfo>* concrete_key_systems) { | 95 static void AddClearKey(std::vector<KeySystemInfo>* concrete_key_systems) { |
79 KeySystemInfo info; | 96 KeySystemInfo info; |
80 info.key_system = kClearKeyKeySystem; | 97 info.key_system = kClearKeyKeySystem; |
81 | 98 |
82 // On Android, Vorbis, VP8, AAC and AVC1 are supported in MediaCodec: | 99 // On Android, Vorbis, VP8, AAC and AVC1 are supported in MediaCodec: |
83 // http://developer.android.com/guide/appendix/media-formats.html | 100 // http://developer.android.com/guide/appendix/media-formats.html |
84 // VP9 support is device dependent. | 101 // VP9 support is device dependent. |
85 | 102 |
86 info.supported_init_data_types = EME_INIT_DATA_TYPE_WEBM; | 103 info.supported_init_data_types = EME_INIT_DATA_TYPE_WEBM; |
87 info.supported_codecs = EME_CODEC_WEBM_ALL; | 104 info.supported_codecs = EME_CODEC_WEBM_ALL; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 bool is_prefixed); | 199 bool is_prefixed); |
183 | 200 |
184 std::string GetKeySystemNameForUMA(const std::string& key_system) const; | 201 std::string GetKeySystemNameForUMA(const std::string& key_system) const; |
185 | 202 |
186 bool UseAesDecryptor(const std::string& concrete_key_system); | 203 bool UseAesDecryptor(const std::string& concrete_key_system); |
187 | 204 |
188 #if defined(ENABLE_PEPPER_CDMS) | 205 #if defined(ENABLE_PEPPER_CDMS) |
189 std::string GetPepperType(const std::string& concrete_key_system); | 206 std::string GetPepperType(const std::string& concrete_key_system); |
190 #endif | 207 #endif |
191 | 208 |
192 bool IsPersistentLicenseSessionSupported( | 209 EmeRequirementSupport GetRobustnessRequirementSupport( |
193 const std::string& key_system, | 210 const std::string& key_system, |
194 bool is_permission_granted); | 211 EmeMediaType media_type, |
212 EmeRobustness robustness); | |
195 | 213 |
196 bool IsPersistentReleaseMessageSessionSupported( | 214 EmeRequirementSupport GetPersistentLicenseSessionSupport( |
215 const std::string& key_system); | |
216 | |
217 EmeRequirementSupport GetPersistentReleaseMessageSessionSupport( | |
218 const std::string& key_system); | |
219 | |
220 EmeRequirementSupport GetPersistentStateRequirementSupport( | |
197 const std::string& key_system, | 221 const std::string& key_system, |
198 bool is_permission_granted); | 222 EmeFeatureRequirement requirement); |
199 | 223 |
200 bool IsPersistentStateRequirementSupported( | 224 EmeRequirementSupport GetDistinctiveIdentifierRequirementSupport( |
201 const std::string& key_system, | 225 const std::string& key_system, |
202 EmeFeatureRequirement requirement, | 226 EmeFeatureRequirement requirement); |
203 bool is_permission_granted); | |
204 | |
205 bool IsDistinctiveIdentifierRequirementSupported( | |
206 const std::string& key_system, | |
207 EmeFeatureRequirement requirement, | |
208 bool is_permission_granted); | |
209 | 227 |
210 void AddContainerMask(const std::string& container, uint32 mask); | 228 void AddContainerMask(const std::string& container, uint32 mask); |
211 void AddCodecMask(const std::string& codec, uint32 mask); | 229 void AddCodecMask(const std::string& codec, uint32 mask); |
212 | 230 |
213 private: | 231 private: |
214 void InitializeUMAInfo(); | 232 void InitializeUMAInfo(); |
215 | 233 |
216 void UpdateSupportedKeySystems(); | 234 void UpdateSupportedKeySystems(); |
217 | 235 |
218 void AddConcreteSupportedKeySystems( | 236 void AddConcreteSupportedKeySystems( |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
385 } | 403 } |
386 | 404 |
387 void KeySystems::AddConcreteSupportedKeySystems( | 405 void KeySystems::AddConcreteSupportedKeySystems( |
388 const std::vector<KeySystemInfo>& concrete_key_systems) { | 406 const std::vector<KeySystemInfo>& concrete_key_systems) { |
389 DCHECK(thread_checker_.CalledOnValidThread()); | 407 DCHECK(thread_checker_.CalledOnValidThread()); |
390 DCHECK(concrete_key_system_map_.empty()); | 408 DCHECK(concrete_key_system_map_.empty()); |
391 DCHECK(parent_key_system_map_.empty()); | 409 DCHECK(parent_key_system_map_.empty()); |
392 | 410 |
393 for (const KeySystemInfo& info : concrete_key_systems) { | 411 for (const KeySystemInfo& info : concrete_key_systems) { |
394 DCHECK(!info.key_system.empty()); | 412 DCHECK(!info.key_system.empty()); |
395 DCHECK_NE(info.persistent_license_support, EME_SESSION_TYPE_INVALID); | 413 DCHECK(info.max_audio_robustness != EmeRobustness::INVALID); |
396 DCHECK_NE(info.persistent_release_message_support, | 414 DCHECK(info.max_video_robustness != EmeRobustness::INVALID); |
397 EME_SESSION_TYPE_INVALID); | 415 DCHECK(info.persistent_license_support != EME_SESSION_TYPE_INVALID); |
398 // TODO(sandersd): Add REQUESTABLE and REQUESTABLE_WITH_PERMISSION for | 416 DCHECK(info.persistent_release_message_support != EME_SESSION_TYPE_INVALID); |
399 // persistent_state_support once we can block access per-CDM-instance | 417 DCHECK(info.persistent_state_support != EME_FEATURE_INVALID); |
ddorwin
2015/03/13 19:24:47
Note: We've only addressed the TODO for desktop. D
sandersd (OOO until July 31)
2015/03/13 20:11:56
Done.
| |
400 // (http://crbug.com/457482). | 418 DCHECK(info.distinctive_identifier_support != EME_FEATURE_INVALID); |
401 DCHECK(info.persistent_state_support == EME_FEATURE_NOT_SUPPORTED || | 419 // Distinctive identifiers cannot be requestable without permission. |
402 info.persistent_state_support == EME_FEATURE_ALWAYS_ENABLED); | 420 DCHECK(info.distinctive_identifier_support != EME_FEATURE_REQUESTABLE); |
403 // TODO(sandersd): Allow REQUESTABLE_WITH_PERMISSION for all key systems on | |
404 // all platforms once we have proper enforcement (http://crbug.com/457482). | |
405 // On Chrome OS, an ID will not be used without permission, but we cannot | |
406 // currently prevent the CDM from requesting the permission again when no | |
407 // there was no initial prompt. Thus, we block "not-allowed" below. | |
408 #if defined(OS_CHROMEOS) | |
409 DCHECK(info.distinctive_identifier_support == EME_FEATURE_NOT_SUPPORTED || | |
410 (info.distinctive_identifier_support == | |
411 EME_FEATURE_REQUESTABLE_WITH_PERMISSION && | |
412 info.key_system == kWidevineKeySystem) || | |
413 info.distinctive_identifier_support == EME_FEATURE_ALWAYS_ENABLED); | |
414 #else | |
415 DCHECK(info.distinctive_identifier_support == EME_FEATURE_NOT_SUPPORTED || | |
416 info.distinctive_identifier_support == EME_FEATURE_ALWAYS_ENABLED); | |
417 #endif | |
418 if (info.persistent_state_support == EME_FEATURE_NOT_SUPPORTED) { | 421 if (info.persistent_state_support == EME_FEATURE_NOT_SUPPORTED) { |
419 DCHECK_EQ(info.persistent_license_support, | 422 DCHECK(info.persistent_license_support == EME_SESSION_TYPE_NOT_SUPPORTED); |
420 EME_SESSION_TYPE_NOT_SUPPORTED); | 423 DCHECK(info.persistent_release_message_support == |
421 DCHECK_EQ(info.persistent_release_message_support, | 424 EME_SESSION_TYPE_NOT_SUPPORTED); |
422 EME_SESSION_TYPE_NOT_SUPPORTED); | |
423 } | 425 } |
424 DCHECK(!IsSupportedKeySystem(info.key_system)) | 426 DCHECK(!IsSupportedKeySystem(info.key_system)) |
425 << "Key system '" << info.key_system << "' already registered"; | 427 << "Key system '" << info.key_system << "' already registered"; |
426 DCHECK(!parent_key_system_map_.count(info.key_system)) | 428 DCHECK(!parent_key_system_map_.count(info.key_system)) |
427 << "'" << info.key_system << "' is already registered as a parent"; | 429 << "'" << info.key_system << "' is already registered as a parent"; |
428 #if defined(ENABLE_PEPPER_CDMS) | 430 #if defined(ENABLE_PEPPER_CDMS) |
429 DCHECK_EQ(info.use_aes_decryptor, info.pepper_type.empty()); | 431 DCHECK_EQ(info.use_aes_decryptor, info.pepper_type.empty()); |
430 #endif | 432 #endif |
431 | 433 |
432 concrete_key_system_map_[info.key_system] = info; | 434 concrete_key_system_map_[info.key_system] = info; |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
611 DLOG(FATAL) << concrete_key_system << " is not a known concrete system"; | 613 DLOG(FATAL) << concrete_key_system << " is not a known concrete system"; |
612 return std::string(); | 614 return std::string(); |
613 } | 615 } |
614 | 616 |
615 const std::string& type = key_system_iter->second.pepper_type; | 617 const std::string& type = key_system_iter->second.pepper_type; |
616 DLOG_IF(FATAL, type.empty()) << concrete_key_system << " is not Pepper-based"; | 618 DLOG_IF(FATAL, type.empty()) << concrete_key_system << " is not Pepper-based"; |
617 return type; | 619 return type; |
618 } | 620 } |
619 #endif | 621 #endif |
620 | 622 |
621 bool KeySystems::IsPersistentLicenseSessionSupported( | 623 EmeRequirementSupport KeySystems::GetRobustnessRequirementSupport( |
622 const std::string& key_system, | 624 const std::string& key_system, |
623 bool is_permission_granted) { | 625 EmeMediaType media_type, |
626 EmeRobustness robustness) { | |
627 DCHECK(thread_checker_.CalledOnValidThread()); | |
628 | |
629 if (robustness == EmeRobustness::INVALID) | |
630 return EME_REQUIREMENT_NOT_SUPPORTED; | |
631 if (robustness == EmeRobustness::EMPTY) | |
632 return EME_REQUIREMENT_SUPPORTED; | |
633 | |
634 KeySystemInfoMap::const_iterator key_system_iter = | |
635 concrete_key_system_map_.find(key_system); | |
636 if (key_system_iter == concrete_key_system_map_.end()) { | |
637 NOTREACHED(); | |
638 return EME_REQUIREMENT_NOT_SUPPORTED; | |
639 } | |
640 | |
641 EmeRobustness max_robustness = EmeRobustness::INVALID; | |
642 switch (media_type) { | |
643 case EmeMediaType::AUDIO: | |
644 max_robustness = key_system_iter->second.max_audio_robustness; | |
645 break; | |
646 case EmeMediaType::VIDEO: | |
647 max_robustness = key_system_iter->second.max_video_robustness; | |
648 break; | |
649 } | |
650 | |
651 #if defined(OS_CHROMEOS) | |
652 if (key_system == kWidevineKeySystem) { | |
653 // CrOS Widevine supports L1 when remote attestation succeeds, but the | |
654 // encrypted media permission is required to do so. Even when not strictly | |
655 // requred, we prefer to support L1 for video because it allows hardware | |
656 // acceleration to be used. | |
657 // TODO(sandersd): Only recommend permission when hardware acceleration is | |
658 // available for the specific codecs requested. | |
659 EmeRequirementSupport recommendation = | |
660 (media_type == EmeMediaType::VIDEO) | |
661 ? EME_REQUIREMENT_SUPPORTED_PERMISSION_RECOMMENDED | |
662 : EME_REQUIREMENT_SUPPORTED; | |
663 return (robustness <= max_robustness) | |
664 ? recommendation | |
665 : EME_REQUIREMENT_SUPPORTED_WITH_PERMISSION; | |
666 } | |
667 #endif // defined(OS_CHROMEOS) | |
668 | |
669 return (robustness <= max_robustness) | |
670 ? EME_REQUIREMENT_SUPPORTED | |
671 : EME_REQUIREMENT_NOT_SUPPORTED; | |
672 } | |
673 | |
674 EmeRequirementSupport KeySystems::GetPersistentLicenseSessionSupport( | |
675 const std::string& key_system) { | |
624 DCHECK(thread_checker_.CalledOnValidThread()); | 676 DCHECK(thread_checker_.CalledOnValidThread()); |
625 | 677 |
626 KeySystemInfoMap::const_iterator key_system_iter = | 678 KeySystemInfoMap::const_iterator key_system_iter = |
627 concrete_key_system_map_.find(key_system); | 679 concrete_key_system_map_.find(key_system); |
628 if (key_system_iter == concrete_key_system_map_.end()) { | 680 if (key_system_iter == concrete_key_system_map_.end()) { |
629 NOTREACHED(); | 681 NOTREACHED(); |
630 return false; | 682 return EME_REQUIREMENT_NOT_SUPPORTED; |
631 } | 683 } |
632 | 684 return ConvertSessionTypeSupport( |
633 switch (key_system_iter->second.persistent_license_support) { | 685 key_system_iter->second.persistent_license_support); |
634 case EME_SESSION_TYPE_INVALID: | |
635 NOTREACHED(); | |
636 return false; | |
637 case EME_SESSION_TYPE_NOT_SUPPORTED: | |
638 return false; | |
639 case EME_SESSION_TYPE_SUPPORTED_WITH_PERMISSION: | |
640 return is_permission_granted; | |
641 case EME_SESSION_TYPE_SUPPORTED: | |
642 return true; | |
643 } | |
644 | |
645 NOTREACHED(); | |
646 return false; | |
647 } | 686 } |
648 | 687 |
649 bool KeySystems::IsPersistentReleaseMessageSessionSupported( | 688 EmeRequirementSupport KeySystems::GetPersistentReleaseMessageSessionSupport( |
650 const std::string& key_system, | 689 const std::string& key_system) { |
651 bool is_permission_granted) { | |
652 DCHECK(thread_checker_.CalledOnValidThread()); | 690 DCHECK(thread_checker_.CalledOnValidThread()); |
653 | 691 |
654 KeySystemInfoMap::const_iterator key_system_iter = | 692 KeySystemInfoMap::const_iterator key_system_iter = |
655 concrete_key_system_map_.find(key_system); | 693 concrete_key_system_map_.find(key_system); |
656 if (key_system_iter == concrete_key_system_map_.end()) { | 694 if (key_system_iter == concrete_key_system_map_.end()) { |
657 NOTREACHED(); | 695 NOTREACHED(); |
658 return false; | 696 return EME_REQUIREMENT_NOT_SUPPORTED; |
659 } | 697 } |
660 | 698 return ConvertSessionTypeSupport( |
661 switch (key_system_iter->second.persistent_release_message_support) { | 699 key_system_iter->second.persistent_release_message_support); |
662 case EME_SESSION_TYPE_INVALID: | |
663 NOTREACHED(); | |
664 return false; | |
665 case EME_SESSION_TYPE_NOT_SUPPORTED: | |
666 return false; | |
667 case EME_SESSION_TYPE_SUPPORTED_WITH_PERMISSION: | |
668 return is_permission_granted; | |
669 case EME_SESSION_TYPE_SUPPORTED: | |
670 return true; | |
671 } | |
672 | |
673 NOTREACHED(); | |
674 return false; | |
675 } | 700 } |
676 | 701 |
677 bool KeySystems::IsPersistentStateRequirementSupported( | 702 EmeRequirementSupport KeySystems::GetPersistentStateRequirementSupport( |
678 const std::string& key_system, | 703 const std::string& key_system, |
679 EmeFeatureRequirement requirement, | 704 EmeFeatureRequirement requirement) { |
680 bool is_permission_granted) { | |
681 DCHECK(thread_checker_.CalledOnValidThread()); | 705 DCHECK(thread_checker_.CalledOnValidThread()); |
682 | 706 |
683 KeySystemInfoMap::const_iterator key_system_iter = | 707 KeySystemInfoMap::const_iterator key_system_iter = |
684 concrete_key_system_map_.find(key_system); | 708 concrete_key_system_map_.find(key_system); |
685 if (key_system_iter == concrete_key_system_map_.end()) { | 709 if (key_system_iter == concrete_key_system_map_.end()) { |
686 NOTREACHED(); | 710 NOTREACHED(); |
687 return false; | 711 return EME_REQUIREMENT_NOT_SUPPORTED; |
688 } | 712 } |
689 | 713 |
690 switch (key_system_iter->second.persistent_state_support) { | 714 EmeFeatureSupport support = key_system_iter->second.persistent_state_support; |
691 case EME_FEATURE_INVALID: | 715 if (support == EME_FEATURE_NOT_SUPPORTED && |
692 NOTREACHED(); | 716 requirement == EME_FEATURE_REQUIRED) { |
693 return false; | 717 return EME_REQUIREMENT_NOT_SUPPORTED; |
694 case EME_FEATURE_NOT_SUPPORTED: | 718 } |
695 return requirement != EME_FEATURE_REQUIRED; | 719 if (support == EME_FEATURE_ALWAYS_ENABLED && |
696 case EME_FEATURE_REQUESTABLE_WITH_PERMISSION: | 720 requirement == EME_FEATURE_NOT_ALLOWED) { |
697 return (requirement != EME_FEATURE_REQUIRED) || is_permission_granted; | 721 return EME_REQUIREMENT_NOT_SUPPORTED; |
698 case EME_FEATURE_REQUESTABLE: | |
699 return true; | |
700 case EME_FEATURE_ALWAYS_ENABLED: | |
701 // Persistent state does not require user permission, but the session | |
702 // types that use it might. | |
703 return requirement != EME_FEATURE_NOT_ALLOWED; | |
704 } | 722 } |
705 | 723 |
706 NOTREACHED(); | 724 // Permission is required only if the feature requires it; permission may |
707 return false; | 725 // still be required for individual persistent session types. Permission |
726 // for optional requirements will be handled when they are resolved to | |
727 // a specific value. | |
728 if (support == EME_FEATURE_REQUESTABLE_WITH_PERMISSION && | |
729 requirement == EME_FEATURE_REQUIRED) { | |
730 return EME_REQUIREMENT_SUPPORTED_WITH_PERMISSION; | |
731 } | |
732 return EME_REQUIREMENT_SUPPORTED; | |
708 } | 733 } |
709 | 734 |
710 bool KeySystems::IsDistinctiveIdentifierRequirementSupported( | 735 EmeRequirementSupport KeySystems::GetDistinctiveIdentifierRequirementSupport( |
711 const std::string& key_system, | 736 const std::string& key_system, |
712 EmeFeatureRequirement requirement, | 737 EmeFeatureRequirement requirement) { |
713 bool is_permission_granted) { | |
714 DCHECK(thread_checker_.CalledOnValidThread()); | 738 DCHECK(thread_checker_.CalledOnValidThread()); |
715 | 739 |
716 KeySystemInfoMap::const_iterator key_system_iter = | 740 KeySystemInfoMap::const_iterator key_system_iter = |
717 concrete_key_system_map_.find(key_system); | 741 concrete_key_system_map_.find(key_system); |
718 if (key_system_iter == concrete_key_system_map_.end()) { | 742 if (key_system_iter == concrete_key_system_map_.end()) { |
719 NOTREACHED(); | 743 NOTREACHED(); |
720 return false; | 744 return EME_REQUIREMENT_NOT_SUPPORTED; |
721 } | 745 } |
722 | 746 |
723 switch (key_system_iter->second.distinctive_identifier_support) { | 747 EmeFeatureSupport support = |
724 case EME_FEATURE_INVALID: | 748 key_system_iter->second.distinctive_identifier_support; |
725 NOTREACHED(); | 749 if (support == EME_FEATURE_NOT_SUPPORTED && |
726 return false; | 750 requirement == EME_FEATURE_REQUIRED) { |
727 case EME_FEATURE_NOT_SUPPORTED: | 751 return EME_REQUIREMENT_NOT_SUPPORTED; |
728 return requirement != EME_FEATURE_REQUIRED; | 752 } |
729 case EME_FEATURE_REQUESTABLE_WITH_PERMISSION: | 753 if (support == EME_FEATURE_ALWAYS_ENABLED && |
730 // TODO(sandersd): Remove this hack once crbug.com/457482 and | 754 requirement == EME_FEATURE_NOT_ALLOWED) { |
731 // crbug.com/460616 are addressed. | 755 return EME_REQUIREMENT_NOT_SUPPORTED; |
732 // We cannot currently enforce "not-allowed", so don't allow it. | |
733 // Note: Removing this check will expose crbug.com/460616. | |
734 if (requirement == EME_FEATURE_NOT_ALLOWED) | |
735 return false; | |
736 return (requirement != EME_FEATURE_REQUIRED) || is_permission_granted; | |
737 case EME_FEATURE_REQUESTABLE: | |
738 NOTREACHED(); | |
739 return true; | |
740 case EME_FEATURE_ALWAYS_ENABLED: | |
741 // Distinctive identifiers always require user permission. | |
742 return (requirement != EME_FEATURE_NOT_ALLOWED) && is_permission_granted; | |
743 } | 756 } |
744 | 757 |
745 NOTREACHED(); | 758 // Permission is always required, but permission for optional requirements |
746 return false; | 759 // will be handled when they are resolved to a specific value. |
760 if (requirement == EME_FEATURE_REQUIRED) { | |
761 return EME_REQUIREMENT_SUPPORTED_WITH_PERMISSION; | |
762 } | |
763 return EME_REQUIREMENT_SUPPORTED; | |
747 } | 764 } |
748 | 765 |
749 void KeySystems::AddContainerMask(const std::string& container, uint32 mask) { | 766 void KeySystems::AddContainerMask(const std::string& container, uint32 mask) { |
750 DCHECK(thread_checker_.CalledOnValidThread()); | 767 DCHECK(thread_checker_.CalledOnValidThread()); |
751 DCHECK(!container_to_codec_mask_map_.count(container)); | 768 DCHECK(!container_to_codec_mask_map_.count(container)); |
752 container_to_codec_mask_map_[container] = static_cast<EmeCodec>(mask); | 769 container_to_codec_mask_map_[container] = static_cast<EmeCodec>(mask); |
753 } | 770 } |
754 | 771 |
755 void KeySystems::AddCodecMask(const std::string& codec, uint32 mask) { | 772 void KeySystems::AddCodecMask(const std::string& codec, uint32 mask) { |
756 DCHECK(thread_checker_.CalledOnValidThread()); | 773 DCHECK(thread_checker_.CalledOnValidThread()); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
841 bool CanUseAesDecryptor(const std::string& concrete_key_system) { | 858 bool CanUseAesDecryptor(const std::string& concrete_key_system) { |
842 return KeySystems::GetInstance().UseAesDecryptor(concrete_key_system); | 859 return KeySystems::GetInstance().UseAesDecryptor(concrete_key_system); |
843 } | 860 } |
844 | 861 |
845 #if defined(ENABLE_PEPPER_CDMS) | 862 #if defined(ENABLE_PEPPER_CDMS) |
846 std::string GetPepperType(const std::string& concrete_key_system) { | 863 std::string GetPepperType(const std::string& concrete_key_system) { |
847 return KeySystems::GetInstance().GetPepperType(concrete_key_system); | 864 return KeySystems::GetInstance().GetPepperType(concrete_key_system); |
848 } | 865 } |
849 #endif | 866 #endif |
850 | 867 |
851 bool IsPersistentLicenseSessionSupported( | 868 EmeRequirementSupport GetRobustnessRequirementSupport( |
852 const std::string& key_system, | 869 const std::string& key_system, |
853 bool is_permission_granted) { | 870 EmeMediaType media_type, |
854 return KeySystems::GetInstance().IsPersistentLicenseSessionSupported( | 871 EmeRobustness robustness) { |
855 key_system, is_permission_granted); | 872 return KeySystems::GetInstance().GetRobustnessRequirementSupport( |
873 key_system, media_type, robustness); | |
856 } | 874 } |
857 | 875 |
858 bool IsPersistentReleaseMessageSessionSupported( | 876 EmeRequirementSupport GetPersistentLicenseSessionSupport( |
859 const std::string& key_system, | 877 const std::string& key_system) { |
860 bool is_permission_granted) { | 878 return KeySystems::GetInstance().GetPersistentLicenseSessionSupport( |
861 return KeySystems::GetInstance().IsPersistentReleaseMessageSessionSupported( | 879 key_system); |
862 key_system, is_permission_granted); | |
863 } | 880 } |
864 | 881 |
865 bool IsPersistentStateRequirementSupported( | 882 EmeRequirementSupport GetPersistentReleaseMessageSessionSupport( |
866 const std::string& key_system, | 883 const std::string& key_system) { |
867 EmeFeatureRequirement requirement, | 884 return KeySystems::GetInstance().GetPersistentReleaseMessageSessionSupport( |
868 bool is_permission_granted) { | 885 key_system); |
869 return KeySystems::GetInstance().IsPersistentStateRequirementSupported( | |
870 key_system, requirement, is_permission_granted); | |
871 } | 886 } |
872 | 887 |
873 bool IsDistinctiveIdentifierRequirementSupported( | 888 EmeRequirementSupport GetPersistentStateRequirementSupport( |
874 const std::string& key_system, | 889 const std::string& key_system, |
875 EmeFeatureRequirement requirement, | 890 EmeFeatureRequirement requirement) { |
876 bool is_permission_granted) { | 891 return KeySystems::GetInstance().GetPersistentStateRequirementSupport( |
877 return KeySystems::GetInstance().IsDistinctiveIdentifierRequirementSupported( | 892 key_system, requirement); |
878 key_system, requirement, is_permission_granted); | 893 } |
894 | |
895 EmeRequirementSupport GetDistinctiveIdentifierRequirementSupport( | |
896 const std::string& key_system, | |
897 EmeFeatureRequirement requirement) { | |
898 return KeySystems::GetInstance().GetDistinctiveIdentifierRequirementSupport( | |
899 key_system, requirement); | |
879 } | 900 } |
880 | 901 |
881 // These two functions are for testing purpose only. The declaration in the | 902 // These two functions are for testing purpose only. The declaration in the |
882 // header file is guarded by "#if defined(UNIT_TEST)" so that they can be used | 903 // header file is guarded by "#if defined(UNIT_TEST)" so that they can be used |
883 // by tests but not non-test code. However, this .cc file is compiled as part of | 904 // by tests but not non-test code. However, this .cc file is compiled as part of |
884 // "media" where "UNIT_TEST" is not defined. So we need to specify | 905 // "media" where "UNIT_TEST" is not defined. So we need to specify |
885 // "MEDIA_EXPORT" here again so that they are visible to tests. | 906 // "MEDIA_EXPORT" here again so that they are visible to tests. |
886 | 907 |
887 MEDIA_EXPORT void AddContainerMask(const std::string& container, uint32 mask) { | 908 MEDIA_EXPORT void AddContainerMask(const std::string& container, uint32 mask) { |
888 KeySystems::GetInstance().AddContainerMask(container, mask); | 909 KeySystems::GetInstance().AddContainerMask(container, mask); |
889 } | 910 } |
890 | 911 |
891 MEDIA_EXPORT void AddCodecMask(const std::string& codec, uint32 mask) { | 912 MEDIA_EXPORT void AddCodecMask(const std::string& codec, uint32 mask) { |
892 KeySystems::GetInstance().AddCodecMask(codec, mask); | 913 KeySystems::GetInstance().AddCodecMask(codec, mask); |
893 } | 914 } |
894 | 915 |
895 } // namespace media | 916 } // namespace media |
OLD | NEW |