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

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

Issue 2793163003: Add EME support for new VP9 codec string in WebM. (Closed)
Patch Set: Add another debug log Created 3 years, 8 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/base/mime_util_internal.cc » ('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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 }; 50 };
51 51
52 // Mapping between codec names and enum values. 52 // Mapping between codec names and enum values.
53 static const NamedCodec kCodecStrings[] = { 53 static const NamedCodec kCodecStrings[] = {
54 {"opus", EME_CODEC_WEBM_OPUS}, // Opus. 54 {"opus", EME_CODEC_WEBM_OPUS}, // Opus.
55 {"vorbis", EME_CODEC_WEBM_VORBIS}, // Vorbis. 55 {"vorbis", EME_CODEC_WEBM_VORBIS}, // Vorbis.
56 {"vp8", EME_CODEC_WEBM_VP8}, // VP8. 56 {"vp8", EME_CODEC_WEBM_VP8}, // VP8.
57 {"vp8.0", EME_CODEC_WEBM_VP8}, // VP8. 57 {"vp8.0", EME_CODEC_WEBM_VP8}, // VP8.
58 {"vp9", EME_CODEC_WEBM_VP9}, // VP9. 58 {"vp9", EME_CODEC_WEBM_VP9}, // VP9.
59 {"vp9.0", EME_CODEC_WEBM_VP9}, // VP9. 59 {"vp9.0", EME_CODEC_WEBM_VP9}, // VP9.
60 {"vp09", EME_CODEC_COMMON_VP9}, // New multi-part VP9 for WebM and MP4.
60 #if BUILDFLAG(USE_PROPRIETARY_CODECS) 61 #if BUILDFLAG(USE_PROPRIETARY_CODECS)
61 {"vp09", EME_CODEC_MP4_VP9}, // VP9 in MP4.
62 {"mp4a", EME_CODEC_MP4_AAC}, // AAC. 62 {"mp4a", EME_CODEC_MP4_AAC}, // AAC.
63 {"avc1", EME_CODEC_MP4_AVC1}, // AVC1. 63 {"avc1", EME_CODEC_MP4_AVC1}, // AVC1.
64 {"avc3", EME_CODEC_MP4_AVC1}, // AVC3. 64 {"avc3", EME_CODEC_MP4_AVC1}, // AVC3.
65 #if BUILDFLAG(ENABLE_HEVC_DEMUXING) 65 #if BUILDFLAG(ENABLE_HEVC_DEMUXING)
66 {"hev1", EME_CODEC_MP4_HEVC}, // HEV1. 66 {"hev1", EME_CODEC_MP4_HEVC}, // HEV1.
67 {"hvc1", EME_CODEC_MP4_HEVC}, // HVC1. 67 {"hvc1", EME_CODEC_MP4_HEVC}, // HVC1.
68 #endif 68 #endif
69 #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) 69 #endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
70 }; 70 };
71 71
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 key_system_iter->second->GetSupportedCodecs(); 592 key_system_iter->second->GetSupportedCodecs();
593 #if defined(OS_ANDROID) 593 #if defined(OS_ANDROID)
594 SupportedCodecs key_system_secure_codec_mask = 594 SupportedCodecs key_system_secure_codec_mask =
595 key_system_iter->second->GetSupportedSecureCodecs(); 595 key_system_iter->second->GetSupportedSecureCodecs();
596 #endif // defined(OS_ANDROID) 596 #endif // defined(OS_ANDROID)
597 597
598 // Check that the container is supported by the key system. (This check is 598 // Check that the container is supported by the key system. (This check is
599 // necessary because |codecs| may be empty.) 599 // necessary because |codecs| may be empty.)
600 SupportedCodecs mime_type_codec_mask = 600 SupportedCodecs mime_type_codec_mask =
601 GetCodecMaskForMimeType(container_mime_type); 601 GetCodecMaskForMimeType(container_mime_type);
602 if ((key_system_codec_mask & mime_type_codec_mask) == 0) 602 if ((key_system_codec_mask & mime_type_codec_mask) == 0) {
603 DVLOG(2) << " Container " << container_mime_type << " not supported by "
604 << key_system;
603 return EmeConfigRule::NOT_SUPPORTED; 605 return EmeConfigRule::NOT_SUPPORTED;
606 }
604 607
605 // Check that the codecs are supported by the key system and container. 608 // Check that the codecs are supported by the key system and container.
606 EmeConfigRule support = EmeConfigRule::SUPPORTED; 609 EmeConfigRule support = EmeConfigRule::SUPPORTED;
607 for (size_t i = 0; i < codecs.size(); i++) { 610 for (size_t i = 0; i < codecs.size(); i++) {
608 SupportedCodecs codec = GetCodecForString(codecs[i]); 611 SupportedCodecs codec = GetCodecForString(codecs[i]);
609 if ((codec & key_system_codec_mask & mime_type_codec_mask) == 0) 612 if ((codec & key_system_codec_mask & mime_type_codec_mask) == 0) {
613 DVLOG(2) << " Container/codec pair (" << container_mime_type << " / "
614 << codecs[i] << ") not supported by " << key_system;
610 return EmeConfigRule::NOT_SUPPORTED; 615 return EmeConfigRule::NOT_SUPPORTED;
616 }
611 #if defined(OS_ANDROID) 617 #if defined(OS_ANDROID)
612 // Check whether the codec supports a hardware-secure mode. The goal is to 618 // Check whether the codec supports a hardware-secure mode. The goal is to
613 // prevent mixing of non-hardware-secure codecs with hardware-secure codecs, 619 // prevent mixing of non-hardware-secure codecs with hardware-secure codecs,
614 // since the mode is fixed at CDM creation. 620 // since the mode is fixed at CDM creation.
615 // 621 //
616 // Because the check for regular codec support is early-exit, we don't have 622 // Because the check for regular codec support is early-exit, we don't have
617 // to consider codecs that are only supported in hardware-secure mode. We 623 // to consider codecs that are only supported in hardware-secure mode. We
618 // could do so, and make use of HW_SECURE_CODECS_REQUIRED, if it turns out 624 // could do so, and make use of HW_SECURE_CODECS_REQUIRED, if it turns out
619 // that hardware-secure-only codecs actually exist and are useful. 625 // that hardware-secure-only codecs actually exist and are useful.
620 if ((codec & key_system_secure_codec_mask) == 0) 626 if ((codec & key_system_secure_codec_mask) == 0)
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 uint32_t mask) { 736 uint32_t mask) {
731 KeySystemsImpl::GetInstance()->AddCodecMask(media_type, codec, mask); 737 KeySystemsImpl::GetInstance()->AddCodecMask(media_type, codec, mask);
732 } 738 }
733 739
734 MEDIA_EXPORT void AddMimeTypeCodecMask(const std::string& mime_type, 740 MEDIA_EXPORT void AddMimeTypeCodecMask(const std::string& mime_type,
735 uint32_t mask) { 741 uint32_t mask) {
736 KeySystemsImpl::GetInstance()->AddMimeTypeCodecMask(mime_type, mask); 742 KeySystemsImpl::GetInstance()->AddMimeTypeCodecMask(mime_type, mask);
737 } 743 }
738 744
739 } // namespace media 745 } // namespace media
OLDNEW
« no previous file with comments | « media/base/eme_constants.h ('k') | media/base/mime_util_internal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698