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

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

Issue 1124863005: Restrict use of hardware-secure codecs based on the RendererPreference. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@setsecurity
Patch Set: Correct unittests. Created 5 years, 7 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/eme_constants.h ('k') | media/blink/key_system_config_selector.h » ('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 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
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; if not, indicate 719 // Check whether the codec supports a hardware-secure mode. The goal is to
720 // that hardware-secure codecs are not available for all listed codecs. 720 // prevent mixing of non-hardware-secure codecs with hardware-secure codecs,
721 // since the mode is fixed at CDM creation.
722 //
721 // 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
722 // 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
723 // could do so, and make use of SECURE_CODECS_REQUIRED, if it turns out that 725 // could do so, and make use of SECURE_CODECS_REQUIRED, if it turns out that
724 // hardware-secure-only codecs actually exist and are useful. 726 // hardware-secure-only codecs actually exist and are useful.
725 if ((codec & key_system_secure_codec_mask) == 0) 727 if ((codec & key_system_secure_codec_mask) == 0)
726 support = EmeConfigRule::SECURE_CODECS_NOT_ALLOWED; 728 support = EmeConfigRule::SECURE_CODECS_NOT_ALLOWED;
727 #endif // defined(OS_ANDROID) 729 #endif // defined(OS_ANDROID)
728
729 } 730 }
730 731
731 return support; 732 return support;
732 } 733 }
733 734
734 EmeConfigRule KeySystemsImpl::GetRobustnessConfigRule( 735 EmeConfigRule KeySystemsImpl::GetRobustnessConfigRule(
735 const std::string& key_system, 736 const std::string& key_system,
736 EmeMediaType media_type, 737 EmeMediaType media_type,
737 const std::string& requested_robustness) const { 738 const std::string& requested_robustness) const {
738 DCHECK(thread_checker_.CalledOnValidThread()); 739 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 } 933 }
933 934
934 MEDIA_EXPORT void AddCodecMask( 935 MEDIA_EXPORT void AddCodecMask(
935 EmeMediaType media_type, 936 EmeMediaType media_type,
936 const std::string& codec, 937 const std::string& codec,
937 uint32 mask) { 938 uint32 mask) {
938 KeySystemsImpl::GetInstance()->AddCodecMask(media_type, codec, mask); 939 KeySystemsImpl::GetInstance()->AddCodecMask(media_type, codec, mask);
939 } 940 }
940 941
941 } // namespace media 942 } // namespace media
OLDNEW
« no previous file with comments | « media/base/eme_constants.h ('k') | media/blink/key_system_config_selector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698