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 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 if ((key_system_codec_mask & container_codec_mask) == 0) | 709 if ((key_system_codec_mask & container_codec_mask) == 0) |
710 return EmeConfigRule::NOT_SUPPORTED; | 710 return EmeConfigRule::NOT_SUPPORTED; |
711 | 711 |
712 // Check that the codecs are supported by the key system and container. | 712 // Check that the codecs are supported by the key system and container. |
713 EmeConfigRule support = EmeConfigRule::SUPPORTED; | 713 EmeConfigRule support = EmeConfigRule::SUPPORTED; |
714 for (size_t i = 0; i < codecs.size(); i++) { | 714 for (size_t i = 0; i < codecs.size(); i++) { |
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; if not, indicate |
720 // prevent mixing of non-hardware-secure codecs with hardware-secure codecs, | 720 // that hardware-secure codecs are not available for all listed codecs. |
721 // since the mode is fixed at CDM creation. | |
722 // | |
723 // 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 |
724 // 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 |
725 // could do so, and make use of SECURE_CODECS_REQUIRED, if it turns out that | 723 // could do so, and make use of SECURE_CODECS_REQUIRED, if it turns out that |
726 // hardware-secure-only codecs actually exist and are useful. | 724 // hardware-secure-only codecs actually exist and are useful. |
727 if ((codec & key_system_secure_codec_mask) == 0) | 725 if ((codec & key_system_secure_codec_mask) == 0) |
728 support = EmeConfigRule::SECURE_CODECS_NOT_ALLOWED; | 726 support = EmeConfigRule::SECURE_CODECS_NOT_ALLOWED; |
729 #endif // defined(OS_ANDROID) | 727 #endif // defined(OS_ANDROID) |
| 728 |
730 } | 729 } |
731 | 730 |
732 return support; | 731 return support; |
733 } | 732 } |
734 | 733 |
735 EmeConfigRule KeySystemsImpl::GetRobustnessConfigRule( | 734 EmeConfigRule KeySystemsImpl::GetRobustnessConfigRule( |
736 const std::string& key_system, | 735 const std::string& key_system, |
737 EmeMediaType media_type, | 736 EmeMediaType media_type, |
738 const std::string& requested_robustness) const { | 737 const std::string& requested_robustness) const { |
739 DCHECK(thread_checker_.CalledOnValidThread()); | 738 DCHECK(thread_checker_.CalledOnValidThread()); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 } | 932 } |
934 | 933 |
935 MEDIA_EXPORT void AddCodecMask( | 934 MEDIA_EXPORT void AddCodecMask( |
936 EmeMediaType media_type, | 935 EmeMediaType media_type, |
937 const std::string& codec, | 936 const std::string& codec, |
938 uint32 mask) { | 937 uint32 mask) { |
939 KeySystemsImpl::GetInstance()->AddCodecMask(media_type, codec, mask); | 938 KeySystemsImpl::GetInstance()->AddCodecMask(media_type, codec, mask); |
940 } | 939 } |
941 | 940 |
942 } // namespace media | 941 } // namespace media |
OLD | NEW |