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