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

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

Issue 1586043003: media: Require HW_SECURE_CODECS for other key systems on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | no next file » | 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 <stddef.h> 7 #include <stddef.h>
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 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 // and SW_SECURE_DECODE in some order. If they are exactly those two then the 776 // and SW_SECURE_DECODE in some order. If they are exactly those two then the
777 // robustness requirement is not supported. 777 // robustness requirement is not supported.
778 if ((max_robustness == EmeRobustness::HW_SECURE_CRYPTO && 778 if ((max_robustness == EmeRobustness::HW_SECURE_CRYPTO &&
779 robustness == EmeRobustness::SW_SECURE_DECODE) || 779 robustness == EmeRobustness::SW_SECURE_DECODE) ||
780 (max_robustness == EmeRobustness::SW_SECURE_DECODE && 780 (max_robustness == EmeRobustness::SW_SECURE_DECODE &&
781 robustness == EmeRobustness::HW_SECURE_CRYPTO) || 781 robustness == EmeRobustness::HW_SECURE_CRYPTO) ||
782 robustness > max_robustness) { 782 robustness > max_robustness) {
783 return EmeConfigRule::NOT_SUPPORTED; 783 return EmeConfigRule::NOT_SUPPORTED;
784 } 784 }
785 785
786 #if defined(OS_CHROMEOS)
786 if (key_system == kWidevineKeySystem) { 787 if (key_system == kWidevineKeySystem) {
787 #if defined(OS_CHROMEOS)
788 // TODO(ddorwin): Remove this once we have confirmed it is not necessary. 788 // TODO(ddorwin): Remove this once we have confirmed it is not necessary.
789 // See https://crbug.com/482277 789 // See https://crbug.com/482277
790 if (robustness == EmeRobustness::EMPTY) 790 if (robustness == EmeRobustness::EMPTY)
791 return EmeConfigRule::SUPPORTED; 791 return EmeConfigRule::SUPPORTED;
792 792
793 // Hardware security requires remote attestation. 793 // Hardware security requires remote attestation.
794 if (robustness >= EmeRobustness::HW_SECURE_CRYPTO) 794 if (robustness >= EmeRobustness::HW_SECURE_CRYPTO)
795 return EmeConfigRule::IDENTIFIER_REQUIRED; 795 return EmeConfigRule::IDENTIFIER_REQUIRED;
796 796
797 // For video, recommend remote attestation if HW_SECURE_ALL is available, 797 // For video, recommend remote attestation if HW_SECURE_ALL is available,
798 // because it enables hardware accelerated decoding. 798 // because it enables hardware accelerated decoding.
799 // TODO(sandersd): Only do this when hardware accelerated decoding is 799 // TODO(sandersd): Only do this when hardware accelerated decoding is
800 // available for the requested codecs. 800 // available for the requested codecs.
801 if (media_type == EmeMediaType::VIDEO && 801 if (media_type == EmeMediaType::VIDEO &&
802 max_robustness == EmeRobustness::HW_SECURE_ALL) { 802 max_robustness == EmeRobustness::HW_SECURE_ALL) {
803 return EmeConfigRule::IDENTIFIER_RECOMMENDED; 803 return EmeConfigRule::IDENTIFIER_RECOMMENDED;
804 } 804 }
805 }
805 #elif defined(OS_ANDROID) 806 #elif defined(OS_ANDROID)
806 if (robustness > EmeRobustness::SW_SECURE_CRYPTO) 807 // Require hardware secure codecs for Widevine when SW_SECURE_DECODE or above
807 return EmeConfigRule::HW_SECURE_CODECS_REQUIRED; 808 // is specified, or for all other key systems (excluding Clear Key).
809 if ((key_system == kWidevineKeySystem &&
810 robustness >= EmeRobustness::SW_SECURE_DECODE) ||
xhwang 2016/01/15 01:19:04 I changed this to be >= which I think is more expl
ddorwin 2016/01/15 01:32:06 Agreed.
811 !IsClearKey(key_system)) {
812 return EmeConfigRule::HW_SECURE_CODECS_REQUIRED;
813 }
808 #endif // defined(OS_CHROMEOS) 814 #endif // defined(OS_CHROMEOS)
809 }
810 815
811 return EmeConfigRule::SUPPORTED; 816 return EmeConfigRule::SUPPORTED;
812 } 817 }
813 818
814 EmeSessionTypeSupport KeySystemsImpl::GetPersistentLicenseSessionSupport( 819 EmeSessionTypeSupport KeySystemsImpl::GetPersistentLicenseSessionSupport(
815 const std::string& key_system) const { 820 const std::string& key_system) const {
816 DCHECK(thread_checker_.CalledOnValidThread()); 821 DCHECK(thread_checker_.CalledOnValidThread());
817 822
818 KeySystemInfoMap::const_iterator key_system_iter = 823 KeySystemInfoMap::const_iterator key_system_iter =
819 concrete_key_system_map_.find(key_system); 824 concrete_key_system_map_.find(key_system);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 KeySystemsImpl::GetInstance()->AddContainerMask(container, mask); 938 KeySystemsImpl::GetInstance()->AddContainerMask(container, mask);
934 } 939 }
935 940
936 MEDIA_EXPORT void AddCodecMask(EmeMediaType media_type, 941 MEDIA_EXPORT void AddCodecMask(EmeMediaType media_type,
937 const std::string& codec, 942 const std::string& codec,
938 uint32_t mask) { 943 uint32_t mask) {
939 KeySystemsImpl::GetInstance()->AddCodecMask(media_type, codec, mask); 944 KeySystemsImpl::GetInstance()->AddCodecMask(media_type, codec, mask);
940 } 945 }
941 946
942 } // namespace media 947 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698