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

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

Issue 2006113002: Allow hw secured codecs on chromecast (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: New flag, new key system property Created 4 years, 6 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
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 <memory> 9 #include <memory>
10 10
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 // Look up the key system's supported codecs. 581 // Look up the key system's supported codecs.
582 KeySystemPropertiesMap::const_iterator key_system_iter = 582 KeySystemPropertiesMap::const_iterator key_system_iter =
583 key_system_properties_map_.find(key_system); 583 key_system_properties_map_.find(key_system);
584 if (key_system_iter == key_system_properties_map_.end()) { 584 if (key_system_iter == key_system_properties_map_.end()) {
585 NOTREACHED(); 585 NOTREACHED();
586 return EmeConfigRule::NOT_SUPPORTED; 586 return EmeConfigRule::NOT_SUPPORTED;
587 } 587 }
588 588
589 SupportedCodecs key_system_codec_mask = 589 SupportedCodecs key_system_codec_mask =
590 key_system_iter->second->GetSupportedCodecs(); 590 key_system_iter->second->GetSupportedCodecs();
591 #if defined(OS_ANDROID) 591 #if BUILDFLAG(ENABLE_HW_SECURE_CODEC)
592 SupportedCodecs key_system_secure_codec_mask = 592 SupportedCodecs key_system_secure_codec_mask =
593 key_system_iter->second->GetSupportedSecureCodecs(); 593 key_system_iter->second->GetSupportedSecureCodecs();
594 #endif // defined(OS_ANDROID) 594 #endif // BUILDFLAG(ENABLE_HW_SECURE_CODEC)
595 595
596 // Check that the container is supported by the key system. (This check is 596 // Check that the container is supported by the key system. (This check is
597 // necessary because |codecs| may be empty.) 597 // necessary because |codecs| may be empty.)
598 SupportedCodecs mime_type_codec_mask = 598 SupportedCodecs mime_type_codec_mask =
599 GetCodecMaskForMimeType(container_mime_type); 599 GetCodecMaskForMimeType(container_mime_type);
600 if ((key_system_codec_mask & mime_type_codec_mask) == 0) 600 if ((key_system_codec_mask & mime_type_codec_mask) == 0)
601 return EmeConfigRule::NOT_SUPPORTED; 601 return EmeConfigRule::NOT_SUPPORTED;
602 602
603 // Check that the codecs are supported by the key system and container. 603 // Check that the codecs are supported by the key system and container.
604 EmeConfigRule support = EmeConfigRule::SUPPORTED; 604 EmeConfigRule support = EmeConfigRule::SUPPORTED;
605 for (size_t i = 0; i < codecs.size(); i++) { 605 for (size_t i = 0; i < codecs.size(); i++) {
606 SupportedCodecs codec = GetCodecForString(codecs[i]); 606 SupportedCodecs codec = GetCodecForString(codecs[i]);
607 if ((codec & key_system_codec_mask & mime_type_codec_mask) == 0) 607 if ((codec & key_system_codec_mask & mime_type_codec_mask) == 0)
608 return EmeConfigRule::NOT_SUPPORTED; 608 return EmeConfigRule::NOT_SUPPORTED;
609 #if defined(OS_ANDROID) 609 #if BUILDFLAG(ENABLE_HW_SECURE_CODEC)
610 // Check whether the codec supports a hardware-secure mode. The goal is to 610 // Check whether the codec supports a hardware-secure mode. The goal is to
611 // prevent mixing of non-hardware-secure codecs with hardware-secure codecs, 611 // prevent mixing of non-hardware-secure codecs with hardware-secure codecs,
612 // since the mode is fixed at CDM creation. 612 // since the mode is fixed at CDM creation.
613 // 613 //
614 // Because the check for regular codec support is early-exit, we don't have 614 // Because the check for regular codec support is early-exit, we don't have
615 // to consider codecs that are only supported in hardware-secure mode. We 615 // to consider codecs that are only supported in hardware-secure mode. We
616 // could do so, and make use of HW_SECURE_CODECS_REQUIRED, if it turns out 616 // could do so, and make use of HW_SECURE_CODECS_REQUIRED, if it turns out
617 // that hardware-secure-only codecs actually exist and are useful. 617 // that hardware-secure-only codecs actually exist and are useful.
618 if ((codec & key_system_secure_codec_mask) == 0) 618 if ((codec & key_system_secure_codec_mask) == 0)
619 support = EmeConfigRule::HW_SECURE_CODECS_NOT_ALLOWED; 619 support = EmeConfigRule::HW_SECURE_CODECS_NOT_ALLOWED;
620 #endif // defined(OS_ANDROID) 620 #endif // BUILDFLAG(ENABLE_HW_SECURE_CODEC)
621 } 621 }
622 622
623 return support; 623 return support;
624 } 624 }
625 625
626 EmeConfigRule KeySystemsImpl::GetRobustnessConfigRule( 626 EmeConfigRule KeySystemsImpl::GetRobustnessConfigRule(
627 const std::string& key_system, 627 const std::string& key_system,
628 EmeMediaType media_type, 628 EmeMediaType media_type,
629 const std::string& requested_robustness) const { 629 const std::string& requested_robustness) const {
630 DCHECK(thread_checker_.CalledOnValidThread()); 630 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 uint32_t mask) { 728 uint32_t mask) {
729 KeySystemsImpl::GetInstance()->AddCodecMask(media_type, codec, mask); 729 KeySystemsImpl::GetInstance()->AddCodecMask(media_type, codec, mask);
730 } 730 }
731 731
732 MEDIA_EXPORT void AddMimeTypeCodecMask(const std::string& mime_type, 732 MEDIA_EXPORT void AddMimeTypeCodecMask(const std::string& mime_type,
733 uint32_t mask) { 733 uint32_t mask) {
734 KeySystemsImpl::GetInstance()->AddMimeTypeCodecMask(mime_type, mask); 734 KeySystemsImpl::GetInstance()->AddMimeTypeCodecMask(mime_type, mask);
735 } 735 }
736 736
737 } // namespace media 737 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698