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 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 SupportedCodecs codec = GetCodecForString(codecs[i]); | 715 SupportedCodecs codec = GetCodecForString(codecs[i]); |
716 if ((codec & key_system_codec_mask & container_codec_mask) == 0) | 716 if ((codec & key_system_codec_mask & container_codec_mask) == 0) |
717 return EmeConfigRule::NOT_SUPPORTED; | 717 return EmeConfigRule::NOT_SUPPORTED; |
718 #if defined(OS_ANDROID) | 718 #if defined(OS_ANDROID) |
719 // Check whether the codec supports a hardware-secure mode. The goal is to | 719 // Check whether the codec supports a hardware-secure mode. The goal is to |
720 // prevent mixing of non-hardware-secure codecs with hardware-secure codecs, | 720 // prevent mixing of non-hardware-secure codecs with hardware-secure codecs, |
721 // since the mode is fixed at CDM creation. | 721 // since the mode is fixed at CDM creation. |
722 // | 722 // |
723 // Because the check for regular codec support is early-exit, we don't have | 723 // Because the check for regular codec support is early-exit, we don't have |
724 // to consider codecs that are only supported in hardware-secure mode. We | 724 // to consider codecs that are only supported in hardware-secure mode. We |
725 // could do so, and make use of HW_SECURE_CODECS_REQUIRED, if it turns out | 725 // could do so, and make use of SECURE_CODECS_REQUIRED, if it turns out that |
726 // that hardware-secure-only codecs actually exist and are useful. | 726 // hardware-secure-only codecs actually exist and are useful. |
727 if ((codec & key_system_secure_codec_mask) == 0) | 727 if ((codec & key_system_secure_codec_mask) == 0) |
728 support = EmeConfigRule::HW_SECURE_CODECS_NOT_ALLOWED; | 728 support = EmeConfigRule::SECURE_CODECS_NOT_ALLOWED; |
729 #endif // defined(OS_ANDROID) | 729 #endif // defined(OS_ANDROID) |
730 } | 730 } |
731 | 731 |
732 return support; | 732 return support; |
733 } | 733 } |
734 | 734 |
735 EmeConfigRule KeySystemsImpl::GetRobustnessConfigRule( | 735 EmeConfigRule KeySystemsImpl::GetRobustnessConfigRule( |
736 const std::string& key_system, | 736 const std::string& key_system, |
737 EmeMediaType media_type, | 737 EmeMediaType media_type, |
738 const std::string& requested_robustness) const { | 738 const std::string& requested_robustness) const { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 // For video, recommend remote attestation if HW_SECURE_ALL is available, | 781 // For video, recommend remote attestation if HW_SECURE_ALL is available, |
782 // because it enables hardware accelerated decoding. | 782 // because it enables hardware accelerated decoding. |
783 // TODO(sandersd): Only do this when hardware accelerated decoding is | 783 // TODO(sandersd): Only do this when hardware accelerated decoding is |
784 // available for the requested codecs. | 784 // available for the requested codecs. |
785 if (media_type == EmeMediaType::VIDEO && | 785 if (media_type == EmeMediaType::VIDEO && |
786 max_robustness == EmeRobustness::HW_SECURE_ALL) { | 786 max_robustness == EmeRobustness::HW_SECURE_ALL) { |
787 return EmeConfigRule::IDENTIFIER_RECOMMENDED; | 787 return EmeConfigRule::IDENTIFIER_RECOMMENDED; |
788 } | 788 } |
789 #elif defined(OS_ANDROID) | 789 #elif defined(OS_ANDROID) |
790 if (robustness > EmeRobustness::SW_SECURE_CRYPTO) | 790 if (robustness > EmeRobustness::SW_SECURE_CRYPTO) |
791 return EmeConfigRule::HW_SECURE_CODECS_REQUIRED; | 791 return EmeConfigRule::SECURE_CODECS_REQUIRED; |
792 #endif // defined(OS_CHROMEOS) | 792 #endif // defined(OS_CHROMEOS) |
793 } | 793 } |
794 | 794 |
795 return EmeConfigRule::SUPPORTED; | 795 return EmeConfigRule::SUPPORTED; |
796 } | 796 } |
797 | 797 |
798 EmeSessionTypeSupport KeySystemsImpl::GetPersistentLicenseSessionSupport( | 798 EmeSessionTypeSupport KeySystemsImpl::GetPersistentLicenseSessionSupport( |
799 const std::string& key_system) const { | 799 const std::string& key_system) const { |
800 DCHECK(thread_checker_.CalledOnValidThread()); | 800 DCHECK(thread_checker_.CalledOnValidThread()); |
801 | 801 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 } | 933 } |
934 | 934 |
935 MEDIA_EXPORT void AddCodecMask( | 935 MEDIA_EXPORT void AddCodecMask( |
936 EmeMediaType media_type, | 936 EmeMediaType media_type, |
937 const std::string& codec, | 937 const std::string& codec, |
938 uint32 mask) { | 938 uint32 mask) { |
939 KeySystemsImpl::GetInstance()->AddCodecMask(media_type, codec, mask); | 939 KeySystemsImpl::GetInstance()->AddCodecMask(media_type, codec, mask); |
940 } | 940 } |
941 | 941 |
942 } // namespace media | 942 } // namespace media |
OLD | NEW |