Commit 250aee43 authored by Xiaohan Wang's avatar Xiaohan Wang Committed by Commit Bot

media: VP9 in MP4 and CENC init data type not proprietary for EME

Clean up proprietary codec checks for EME. MP4 is not treated as
"proprietary" anymore. So "proprietary codec" should only be used for
real proprietary codes, e.g. AVC1 or AAC.

Bug: 327115,837783
Test: Tests updated.
Change-Id: I18b762ab543f2cf08c7dec195c28d3ee62143eb8
Reviewed-on: https://chromium-review.googlesource.com/1033695
Commit-Queue: Xiaohan Wang <xhwang@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarJohn Rummell <jrummell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#554623}
parent 17b2a114
...@@ -81,13 +81,13 @@ const char kWebMVorbisAudioOnly[] = "audio/webm; codecs=\"vorbis\""; ...@@ -81,13 +81,13 @@ const char kWebMVorbisAudioOnly[] = "audio/webm; codecs=\"vorbis\"";
const char kWebMVorbisAudioVp8Video[] = "video/webm; codecs=\"vorbis, vp8\""; const char kWebMVorbisAudioVp8Video[] = "video/webm; codecs=\"vorbis, vp8\"";
const char kWebMOpusAudioVp9Video[] = "video/webm; codecs=\"opus, vp9\""; const char kWebMOpusAudioVp9Video[] = "video/webm; codecs=\"opus, vp9\"";
const char kWebMVp9VideoOnly[] = "video/webm; codecs=\"vp9\""; const char kWebMVp9VideoOnly[] = "video/webm; codecs=\"vp9\"";
const char kMp4Vp9VideoOnly[] =
"video/mp4; codecs=\"vp09.00.10.08.01.02.02.02.00\"";
#if BUILDFLAG(ENABLE_LIBRARY_CDMS) #if BUILDFLAG(ENABLE_LIBRARY_CDMS)
const char kWebMVp8VideoOnly[] = "video/webm; codecs=\"vp8\""; const char kWebMVp8VideoOnly[] = "video/webm; codecs=\"vp8\"";
#endif #endif
#if BUILDFLAG(USE_PROPRIETARY_CODECS) #if BUILDFLAG(USE_PROPRIETARY_CODECS)
const char kMp4Avc1VideoOnly[] = "video/mp4; codecs=\"avc1.64001E\""; const char kMp4Avc1VideoOnly[] = "video/mp4; codecs=\"avc1.64001E\"";
const char kMp4Vp9VideoOnly[] =
"video/mp4; codecs=\"vp09.00.10.08.01.02.02.02.00\"";
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) #endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
// Sessions to load. // Sessions to load.
...@@ -580,6 +580,15 @@ IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_Multiple_VideoAudio_WebM) { ...@@ -580,6 +580,15 @@ IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_Multiple_VideoAudio_WebM) {
TestMultiplePlayback("bear-320x240-av_enc-av.webm", kWebMVorbisAudioVp8Video); TestMultiplePlayback("bear-320x240-av_enc-av.webm", kWebMVorbisAudioVp8Video);
} }
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VideoOnly_MP4_VP9) {
// MP4 without MSE is not support yet, http://crbug.com/170793.
if (CurrentSourceType() != SrcType::MSE) {
DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE.";
return;
}
TestSimplePlayback("bear-320x240-v_frag-vp9-cenc.mp4", kMp4Vp9VideoOnly);
}
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, InvalidResponseKeyError) { IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, InvalidResponseKeyError) {
RunInvalidResponseTest(); RunInvalidResponseTest();
} }
...@@ -648,15 +657,6 @@ IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VideoOnly_MP4_MDAT) { ...@@ -648,15 +657,6 @@ IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VideoOnly_MP4_MDAT) {
TestSimplePlayback("bear-640x360-v_frag-cenc-mdat.mp4", kMp4Avc1VideoOnly); TestSimplePlayback("bear-640x360-v_frag-cenc-mdat.mp4", kMp4Avc1VideoOnly);
} }
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VideoOnly_MP4_VP9) {
// MP4 without MSE is not support yet, http://crbug.com/170793.
if (CurrentSourceType() != SrcType::MSE) {
DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE.";
return;
}
TestSimplePlayback("bear-320x240-v_frag-vp9-cenc.mp4", kMp4Vp9VideoOnly);
}
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, IN_PROC_BROWSER_TEST_P(EncryptedMediaTest,
Playback_EncryptedVideo_MP4_ClearAudio_WEBM) { Playback_EncryptedVideo_MP4_ClearAudio_WEBM) {
TestDifferentContainers(EncryptedContainer::ENCRYPTED_MP4, TestDifferentContainers(EncryptedContainer::ENCRYPTED_MP4,
...@@ -755,14 +755,14 @@ IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, DecryptOnly_VideoAudio_WebM) { ...@@ -755,14 +755,14 @@ IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, DecryptOnly_VideoAudio_WebM) {
kExternalClearKeyDecryptOnlyKeySystem, SrcType::MSE); kExternalClearKeyDecryptOnlyKeySystem, SrcType::MSE);
} }
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, DecryptOnly_VideoOnly_MP4_VP9) { IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, DecryptOnly_VideoOnly_MP4_VP9) {
RunSimpleEncryptedMediaTest( RunSimpleEncryptedMediaTest(
"bear-320x240-v_frag-vp9-cenc.mp4", kMp4Vp9VideoOnly, "bear-320x240-v_frag-vp9-cenc.mp4", kMp4Vp9VideoOnly,
kExternalClearKeyDecryptOnlyKeySystem, SrcType::MSE); kExternalClearKeyDecryptOnlyKeySystem, SrcType::MSE);
} }
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
// Encryption Scheme tests. ClearKey key system is covered in // Encryption Scheme tests. ClearKey key system is covered in
// content/browser/media/encrypted_media_browsertest.cc. // content/browser/media/encrypted_media_browsertest.cc.
IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, Playback_Encryption_CENC) { IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, Playback_Encryption_CENC) {
......
...@@ -324,8 +324,7 @@ class EncryptedMediaSupportedTypesTest : public InProcessBrowserTest { ...@@ -324,8 +324,7 @@ class EncryptedMediaSupportedTypesTest : public InProcessBrowserTest {
// For ClearKey, nothing additional is required. // For ClearKey, nothing additional is required.
class EncryptedMediaSupportedTypesClearKeyTest class EncryptedMediaSupportedTypesClearKeyTest
: public EncryptedMediaSupportedTypesTest { : public EncryptedMediaSupportedTypesTest {};
};
// For ExternalClearKey tests, ensure that the ClearKey adapter is loaded. // For ExternalClearKey tests, ensure that the ClearKey adapter is loaded.
class EncryptedMediaSupportedTypesExternalClearKeyTest class EncryptedMediaSupportedTypesExternalClearKeyTest
...@@ -506,13 +505,13 @@ IN_PROC_BROWSER_TEST_F(EncryptedMediaSupportedTypesClearKeyTest, Video_MP4) { ...@@ -506,13 +505,13 @@ IN_PROC_BROWSER_TEST_F(EncryptedMediaSupportedTypesClearKeyTest, Video_MP4) {
// Valid video types. // Valid video types.
EXPECT_PROPRIETARY( EXPECT_PROPRIETARY(
IsSupportedByKeySystem(kClearKey, kVideoMP4MimeType, video_mp4_codecs())); IsSupportedByKeySystem(kClearKey, kVideoMP4MimeType, video_mp4_codecs()));
EXPECT_PROPRIETARY(IsSupportedByKeySystem(kClearKey, kVideoMP4MimeType, EXPECT_SUCCESS(IsSupportedByKeySystem(kClearKey, kVideoMP4MimeType,
video_common_codecs())); video_common_codecs()));
EXPECT_PROPRIETARY(IsSupportedByKeySystem( EXPECT_SUCCESS(IsSupportedByKeySystem(
kClearKey, kVideoMP4MimeType, clear_key_exclusive_video_common_codecs())); kClearKey, kVideoMP4MimeType, clear_key_exclusive_video_common_codecs()));
// High 10-bit Profile is supported when using ClearKey if // High 10-bit Profile is supported when using ClearKey if it is supported for
// it is supported for clear content on this platform. // clear content on this platform.
#if BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS) #if BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS)
EXPECT_PROPRIETARY(IsSupportedByKeySystem(kClearKey, kVideoMP4MimeType, EXPECT_PROPRIETARY(IsSupportedByKeySystem(kClearKey, kVideoMP4MimeType,
video_mp4_hi10p_codecs())); video_mp4_hi10p_codecs()));
...@@ -684,10 +683,8 @@ IN_PROC_BROWSER_TEST_F(EncryptedMediaSupportedTypesExternalClearKeyTest, ...@@ -684,10 +683,8 @@ IN_PROC_BROWSER_TEST_F(EncryptedMediaSupportedTypesExternalClearKeyTest,
// Valid video types. // Valid video types.
EXPECT_ECK_PROPRIETARY(IsSupportedByKeySystem( EXPECT_ECK_PROPRIETARY(IsSupportedByKeySystem(
kExternalClearKey, kVideoMP4MimeType, video_mp4_codecs())); kExternalClearKey, kVideoMP4MimeType, video_mp4_codecs()));
EXPECT_ECK_PROPRIETARY(IsSupportedByKeySystem( EXPECT_ECK(IsSupportedByKeySystem(kExternalClearKey, kVideoMP4MimeType,
kExternalClearKey, kVideoMP4MimeType, video_common_codecs())); video_common_codecs()));
EXPECT_ECK_PROPRIETARY(IsSupportedByKeySystem(
kClearKey, kVideoMP4MimeType, clear_key_exclusive_video_common_codecs()));
// High 10-bit Profile is not supported when using ExternalClearKey. // High 10-bit Profile is not supported when using ExternalClearKey.
EXPECT_UNSUPPORTED(IsSupportedByKeySystem( EXPECT_UNSUPPORTED(IsSupportedByKeySystem(
...@@ -698,6 +695,9 @@ IN_PROC_BROWSER_TEST_F(EncryptedMediaSupportedTypesExternalClearKeyTest, ...@@ -698,6 +695,9 @@ IN_PROC_BROWSER_TEST_F(EncryptedMediaSupportedTypesExternalClearKeyTest,
kExternalClearKey, kVideoMP4MimeType, audio_mp4_codecs())); kExternalClearKey, kVideoMP4MimeType, audio_mp4_codecs()));
// Invalid or non-MP4 codecs. // Invalid or non-MP4 codecs.
EXPECT_UNSUPPORTED(
IsSupportedByKeySystem(kExternalClearKey, kVideoMP4MimeType,
clear_key_exclusive_video_common_codecs()));
EXPECT_UNSUPPORTED(IsSupportedByKeySystem( EXPECT_UNSUPPORTED(IsSupportedByKeySystem(
kExternalClearKey, kVideoMP4MimeType, invalid_codecs())); kExternalClearKey, kVideoMP4MimeType, invalid_codecs()));
EXPECT_UNSUPPORTED(IsSupportedByKeySystem( EXPECT_UNSUPPORTED(IsSupportedByKeySystem(
...@@ -868,8 +868,8 @@ IN_PROC_BROWSER_TEST_F(EncryptedMediaSupportedTypesWidevineTest, Video_MP4) { ...@@ -868,8 +868,8 @@ IN_PROC_BROWSER_TEST_F(EncryptedMediaSupportedTypesWidevineTest, Video_MP4) {
// Valid video types. // Valid video types.
EXPECT_WV_PROPRIETARY( EXPECT_WV_PROPRIETARY(
IsSupportedByKeySystem(kWidevine, kVideoMP4MimeType, video_mp4_codecs())); IsSupportedByKeySystem(kWidevine, kVideoMP4MimeType, video_mp4_codecs()));
EXPECT_WV_PROPRIETARY(IsSupportedByKeySystem(kWidevine, kVideoMP4MimeType, EXPECT_WV_SUCCESS(IsSupportedByKeySystem(kWidevine, kVideoMP4MimeType,
video_common_codecs())); video_common_codecs()));
// High 10-bit Profile is not supported when using Widevine. // High 10-bit Profile is not supported when using Widevine.
EXPECT_UNSUPPORTED(IsSupportedByKeySystem(kWidevine, kVideoMP4MimeType, EXPECT_UNSUPPORTED(IsSupportedByKeySystem(kWidevine, kVideoMP4MimeType,
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "base/macros.h" #include "base/macros.h"
#include "media/cdm/cenc_utils.h" #include "media/cdm/cenc_utils.h"
#include "media/media_buildflags.h"
namespace cdm { namespace cdm {
...@@ -35,13 +34,9 @@ bool WidevineDrmDelegateAndroid::OnCreateSession( ...@@ -35,13 +34,9 @@ bool WidevineDrmDelegateAndroid::OnCreateSession(
if (init_data_type != media::EmeInitDataType::CENC) if (init_data_type != media::EmeInitDataType::CENC)
return true; return true;
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
// Widevine MediaDrm plugin only accepts the "data" part of the PSSH box as // Widevine MediaDrm plugin only accepts the "data" part of the PSSH box as
// the init data when using MP4 container. // the init data when using MP4 container.
return media::GetPsshData(init_data, GetUUID(), init_data_out); return media::GetPsshData(init_data, GetUUID(), init_data_out);
#else
return false;
#endif
} }
} // namespace cdm } // namespace cdm
...@@ -48,11 +48,7 @@ class AndroidPlatformKeySystemProperties : public KeySystemProperties { ...@@ -48,11 +48,7 @@ class AndroidPlatformKeySystemProperties : public KeySystemProperties {
case EmeInitDataType::WEBM: case EmeInitDataType::WEBM:
return (supported_codecs_ & media::EME_CODEC_WEBM_ALL) != 0; return (supported_codecs_ & media::EME_CODEC_WEBM_ALL) != 0;
case EmeInitDataType::CENC: case EmeInitDataType::CENC:
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
return (supported_codecs_ & media::EME_CODEC_MP4_ALL) != 0; return (supported_codecs_ & media::EME_CODEC_MP4_ALL) != 0;
#else
return false;
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
case EmeInitDataType::KEYIDS: case EmeInitDataType::KEYIDS:
case EmeInitDataType::UNKNOWN: case EmeInitDataType::UNKNOWN:
return false; return false;
...@@ -112,8 +108,8 @@ SupportedKeySystemResponse QueryKeySystemSupport( ...@@ -112,8 +108,8 @@ SupportedKeySystemResponse QueryKeySystemSupport(
void AddAndroidWidevine( void AddAndroidWidevine(
std::vector<std::unique_ptr<KeySystemProperties>>* concrete_key_systems) { std::vector<std::unique_ptr<KeySystemProperties>>* concrete_key_systems) {
SupportedKeySystemResponse response = QueryKeySystemSupport( SupportedKeySystemResponse response =
kWidevineKeySystem); QueryKeySystemSupport(kWidevineKeySystem);
// Since we do not control the implementation of the MediaDrm API on Android, // Since we do not control the implementation of the MediaDrm API on Android,
// we assume that it can and will make use of persistence no matter whether // we assume that it can and will make use of persistence no matter whether
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "base/logging.h" #include "base/logging.h"
#include "media/base/eme_constants.h" #include "media/base/eme_constants.h"
#include "media/media_buildflags.h"
namespace cdm { namespace cdm {
...@@ -23,17 +22,11 @@ std::string ExternalClearKeyProperties::GetKeySystemName() const { ...@@ -23,17 +22,11 @@ std::string ExternalClearKeyProperties::GetKeySystemName() const {
bool ExternalClearKeyProperties::IsSupportedInitDataType( bool ExternalClearKeyProperties::IsSupportedInitDataType(
media::EmeInitDataType init_data_type) const { media::EmeInitDataType init_data_type) const {
switch (init_data_type) { switch (init_data_type) {
case media::EmeInitDataType::CENC:
case media::EmeInitDataType::WEBM: case media::EmeInitDataType::WEBM:
case media::EmeInitDataType::KEYIDS: case media::EmeInitDataType::KEYIDS:
return true; return true;
case media::EmeInitDataType::CENC:
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
return true;
#else
return false;
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
case media::EmeInitDataType::UNKNOWN: case media::EmeInitDataType::UNKNOWN:
return false; return false;
} }
...@@ -42,11 +35,7 @@ bool ExternalClearKeyProperties::IsSupportedInitDataType( ...@@ -42,11 +35,7 @@ bool ExternalClearKeyProperties::IsSupportedInitDataType(
} }
media::SupportedCodecs ExternalClearKeyProperties::GetSupportedCodecs() const { media::SupportedCodecs ExternalClearKeyProperties::GetSupportedCodecs() const {
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
return media::EME_CODEC_MP4_ALL | media::EME_CODEC_WEBM_ALL; return media::EME_CODEC_MP4_ALL | media::EME_CODEC_WEBM_ALL;
#else
return media::EME_CODEC_WEBM_ALL;
#endif
} }
media::EmeConfigRule ExternalClearKeyProperties::GetRobustnessConfigRule( media::EmeConfigRule ExternalClearKeyProperties::GetRobustnessConfigRule(
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "components/cdm/renderer/widevine_key_system_properties.h" #include "components/cdm/renderer/widevine_key_system_properties.h"
#include "media/media_buildflags.h"
#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
#if defined(WIDEVINE_CDM_AVAILABLE) #if defined(WIDEVINE_CDM_AVAILABLE)
...@@ -72,10 +71,8 @@ bool WidevineKeySystemProperties::IsSupportedInitDataType( ...@@ -72,10 +71,8 @@ bool WidevineKeySystemProperties::IsSupportedInitDataType(
// |init_data_type| x |container| pairings. // |init_data_type| x |container| pairings.
if (init_data_type == EmeInitDataType::WEBM) if (init_data_type == EmeInitDataType::WEBM)
return (supported_codecs_ & media::EME_CODEC_WEBM_ALL) != 0; return (supported_codecs_ & media::EME_CODEC_WEBM_ALL) != 0;
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
if (init_data_type == EmeInitDataType::CENC) if (init_data_type == EmeInitDataType::CENC)
return (supported_codecs_ & media::EME_CODEC_MP4_ALL) != 0; return (supported_codecs_ & media::EME_CODEC_MP4_ALL) != 0;
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
return false; return false;
} }
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "media/base/key_system_properties.h" #include "media/base/key_system_properties.h"
#include "media/media_buildflags.h"
namespace cdm { namespace cdm {
......
...@@ -51,6 +51,8 @@ const char kWebMVp8VideoOnly[] = "video/webm; codecs=\"vp8\""; ...@@ -51,6 +51,8 @@ const char kWebMVp8VideoOnly[] = "video/webm; codecs=\"vp8\"";
const char kWebMVp9VideoOnly[] = "video/webm; codecs=\"vp9\""; const char kWebMVp9VideoOnly[] = "video/webm; codecs=\"vp9\"";
const char kWebMOpusAudioVp9Video[] = "video/webm; codecs=\"opus, vp9\""; const char kWebMOpusAudioVp9Video[] = "video/webm; codecs=\"opus, vp9\"";
const char kWebMVorbisAudioVp8Video[] = "video/webm; codecs=\"vorbis, vp8\""; const char kWebMVorbisAudioVp8Video[] = "video/webm; codecs=\"vorbis, vp8\"";
const char kMp4Vp9VideoOnly[] =
"video/mp4; codecs=\"vp09.00.10.08.01.02.02.02.00\"";
#if BUILDFLAG(USE_PROPRIETARY_CODECS) #if BUILDFLAG(USE_PROPRIETARY_CODECS)
const char kMp4Avc1VideoOnly[] = "video/mp4; codecs=\"avc1.64001E\""; const char kMp4Avc1VideoOnly[] = "video/mp4; codecs=\"avc1.64001E\"";
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) #endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
...@@ -256,6 +258,15 @@ IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VideoClearAudio_WebM_Opus) { ...@@ -256,6 +258,15 @@ IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VideoClearAudio_WebM_Opus) {
TestSimplePlayback("bear-320x240-opus-av_enc-v.webm", kWebMOpusAudioVp9Video); TestSimplePlayback("bear-320x240-opus-av_enc-v.webm", kWebMOpusAudioVp9Video);
} }
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VideoOnly_MP4_VP9) {
// MP4 without MSE is not support yet, http://crbug.com/170793.
if (CurrentSourceType() != SrcType::MSE) {
DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE.";
return;
}
TestSimplePlayback("bear-320x240-v_frag-vp9-cenc.mp4", kMp4Vp9VideoOnly);
}
// Strictly speaking this is not an "encrypted" media test. Keep it here for // Strictly speaking this is not an "encrypted" media test. Keep it here for
// completeness. // completeness.
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, ConfigChangeVideo_ClearToClear) { IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, ConfigChangeVideo_ClearToClear) {
......
...@@ -22,6 +22,8 @@ enum class EmeInitDataType { UNKNOWN, WEBM, CENC, KEYIDS, MAX = KEYIDS }; ...@@ -22,6 +22,8 @@ enum class EmeInitDataType { UNKNOWN, WEBM, CENC, KEYIDS, MAX = KEYIDS };
// //
// TODO(yucliu): Remove container name from the enum. See crbug.com/724362 for // TODO(yucliu): Remove container name from the enum. See crbug.com/724362 for
// more details. // more details.
// TODO(xhwang): Use constexpr to construct this list. The current code is too
// hard to read and maintain.
enum EmeCodec { enum EmeCodec {
// *_ALL values should only be used for masking, do not use them to specify // *_ALL values should only be used for masking, do not use them to specify
// codec support because they may be extended to include more codecs. // codec support because they may be extended to include more codecs.
...@@ -46,22 +48,17 @@ enum EmeCodec { ...@@ -46,22 +48,17 @@ enum EmeCodec {
#if BUILDFLAG(USE_PROPRIETARY_CODECS) #if BUILDFLAG(USE_PROPRIETARY_CODECS)
EME_CODEC_MP4_AUDIO_ALL = (EME_CODEC_MP4_AAC EME_CODEC_MP4_AUDIO_ALL = (EME_CODEC_MP4_AAC
#if BUILDFLAG(ENABLE_AC3_EAC3_AUDIO_DEMUXING) #if BUILDFLAG(ENABLE_AC3_EAC3_AUDIO_DEMUXING)
| | EME_CODEC_MP4_AC3 | EME_CODEC_MP4_EAC3
EME_CODEC_MP4_AC3 |
EME_CODEC_MP4_EAC3
#endif // BUILDFLAG(ENABLE_AC3_EAC3_AUDIO_DEMUXING) #endif // BUILDFLAG(ENABLE_AC3_EAC3_AUDIO_DEMUXING)
), ),
EME_CODEC_MP4_VIDEO_ALL = (EME_CODEC_MP4_AVC1 | EME_CODEC_COMMON_VP9 EME_CODEC_MP4_VIDEO_ALL = (EME_CODEC_MP4_AVC1 | EME_CODEC_COMMON_VP9
#if BUILDFLAG(ENABLE_HEVC_DEMUXING) #if BUILDFLAG(ENABLE_HEVC_DEMUXING)
| | EME_CODEC_MP4_HEVC
EME_CODEC_MP4_HEVC
#endif // BUILDFLAG(ENABLE_HEVC_DEMUXING) #endif // BUILDFLAG(ENABLE_HEVC_DEMUXING)
#if BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING) #if BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING)
| | EME_CODEC_MP4_DV_AVC
EME_CODEC_MP4_DV_AVC
#if BUILDFLAG(ENABLE_HEVC_DEMUXING) #if BUILDFLAG(ENABLE_HEVC_DEMUXING)
| | EME_CODEC_MP4_DV_HEVC
EME_CODEC_MP4_DV_HEVC
#endif // BUILDFLAG(ENABLE_HEVC_DEMUXING) #endif // BUILDFLAG(ENABLE_HEVC_DEMUXING)
#endif // BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING) #endif // BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING)
), ),
...@@ -79,9 +76,12 @@ enum EmeCodec { ...@@ -79,9 +76,12 @@ enum EmeCodec {
EME_CODEC_ALL = (EME_CODEC_WEBM_ALL | EME_CODEC_MP4_ALL), EME_CODEC_ALL = (EME_CODEC_WEBM_ALL | EME_CODEC_MP4_ALL),
#endif // BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) #endif // BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER)
#else #else
EME_CODEC_AUDIO_ALL = EME_CODEC_WEBM_AUDIO_ALL, EME_CODEC_MP4_AUDIO_ALL = EME_CODEC_NONE,
EME_CODEC_VIDEO_ALL = EME_CODEC_WEBM_VIDEO_ALL, EME_CODEC_MP4_VIDEO_ALL = EME_CODEC_COMMON_VP9,
EME_CODEC_ALL = EME_CODEC_WEBM_ALL, EME_CODEC_MP4_ALL = (EME_CODEC_MP4_AUDIO_ALL | EME_CODEC_MP4_VIDEO_ALL),
EME_CODEC_AUDIO_ALL = EME_CODEC_WEBM_AUDIO_ALL | EME_CODEC_MP4_AUDIO_ALL,
EME_CODEC_VIDEO_ALL = EME_CODEC_WEBM_VIDEO_ALL | EME_CODEC_MP4_VIDEO_ALL,
EME_CODEC_ALL = EME_CODEC_WEBM_ALL | EME_CODEC_MP4_ALL,
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) #endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
}; };
......
...@@ -42,9 +42,9 @@ struct NamedCodec { ...@@ -42,9 +42,9 @@ struct NamedCodec {
static const NamedCodec kMimeTypeToCodecMasks[] = { static const NamedCodec kMimeTypeToCodecMasks[] = {
{"audio/webm", EME_CODEC_WEBM_AUDIO_ALL}, {"audio/webm", EME_CODEC_WEBM_AUDIO_ALL},
{"video/webm", EME_CODEC_WEBM_VIDEO_ALL}, {"video/webm", EME_CODEC_WEBM_VIDEO_ALL},
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
{"audio/mp4", EME_CODEC_MP4_AUDIO_ALL}, {"audio/mp4", EME_CODEC_MP4_AUDIO_ALL},
{"video/mp4", EME_CODEC_MP4_VIDEO_ALL}, {"video/mp4", EME_CODEC_MP4_VIDEO_ALL},
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
#if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER)
{"video/mp2t", EME_CODEC_MP2T_VIDEO_ALL}, {"video/mp2t", EME_CODEC_MP2T_VIDEO_ALL},
#endif // BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) #endif // BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER)
...@@ -88,11 +88,8 @@ class ClearKeyProperties : public KeySystemProperties { ...@@ -88,11 +88,8 @@ class ClearKeyProperties : public KeySystemProperties {
std::string GetKeySystemName() const override { return kClearKeyKeySystem; } std::string GetKeySystemName() const override { return kClearKeyKeySystem; }
bool IsSupportedInitDataType(EmeInitDataType init_data_type) const override { bool IsSupportedInitDataType(EmeInitDataType init_data_type) const override {
#if BUILDFLAG(USE_PROPRIETARY_CODECS) return init_data_type == EmeInitDataType::CENC ||
if (init_data_type == EmeInitDataType::CENC) init_data_type == EmeInitDataType::WEBM ||
return true;
#endif
return init_data_type == EmeInitDataType::WEBM ||
init_data_type == EmeInitDataType::KEYIDS; init_data_type == EmeInitDataType::KEYIDS;
} }
...@@ -100,13 +97,7 @@ class ClearKeyProperties : public KeySystemProperties { ...@@ -100,13 +97,7 @@ class ClearKeyProperties : public KeySystemProperties {
// On Android, Vorbis, VP8, AAC and AVC1 are supported in MediaCodec: // On Android, Vorbis, VP8, AAC and AVC1 are supported in MediaCodec:
// http://developer.android.com/guide/appendix/media-formats.html // http://developer.android.com/guide/appendix/media-formats.html
// VP9 support is device dependent. // VP9 support is device dependent.
SupportedCodecs codecs = EME_CODEC_WEBM_ALL; return EME_CODEC_WEBM_ALL | EME_CODEC_MP4_ALL;
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
codecs |= EME_CODEC_MP4_ALL;
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
return codecs;
} }
EmeConfigRule GetRobustnessConfigRule( EmeConfigRule GetRobustnessConfigRule(
...@@ -445,7 +436,8 @@ void KeySystemsImpl::RegisterMimeType(const std::string& mime_type, ...@@ -445,7 +436,8 @@ void KeySystemsImpl::RegisterMimeType(const std::string& mime_type,
EmeCodec codecs_mask) { EmeCodec codecs_mask) {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(!mime_type_to_codec_mask_map_.count(mime_type)); DCHECK(!mime_type_to_codec_mask_map_.count(mime_type));
DCHECK(IsValidMimeTypeCodecsCombination(mime_type, codecs_mask)); DCHECK(IsValidMimeTypeCodecsCombination(mime_type, codecs_mask))
<< ": mime_type = " << mime_type << ", codecs_mask = " << codecs_mask;
mime_type_to_codec_mask_map_[mime_type] = static_cast<EmeCodec>(codecs_mask); mime_type_to_codec_mask_map_[mime_type] = static_cast<EmeCodec>(codecs_mask);
} }
...@@ -457,8 +449,9 @@ bool KeySystemsImpl::IsValidMimeTypeCodecsCombination( ...@@ -457,8 +449,9 @@ bool KeySystemsImpl::IsValidMimeTypeCodecsCombination(
const std::string& mime_type, const std::string& mime_type,
SupportedCodecs codecs_mask) const { SupportedCodecs codecs_mask) const {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(thread_checker_.CalledOnValidThread());
if (!codecs_mask) if (codecs_mask == EME_CODEC_NONE)
return false; return true;
if (base::StartsWith(mime_type, "audio/", base::CompareCase::SENSITIVE)) if (base::StartsWith(mime_type, "audio/", base::CompareCase::SENSITIVE))
return !(codecs_mask & ~audio_codec_mask_); return !(codecs_mask & ~audio_codec_mask_);
if (base::StartsWith(mime_type, "video/", base::CompareCase::SENSITIVE)) if (base::StartsWith(mime_type, "video/", base::CompareCase::SENSITIVE))
......
...@@ -23,18 +23,14 @@ ...@@ -23,18 +23,14 @@
#include "media/blink/cdm_result_promise_helper.h" #include "media/blink/cdm_result_promise_helper.h"
#include "media/blink/cdm_session_adapter.h" #include "media/blink/cdm_session_adapter.h"
#include "media/blink/webmediaplayer_util.h" #include "media/blink/webmediaplayer_util.h"
#include "media/cdm/cenc_utils.h"
#include "media/cdm/json_web_key.h" #include "media/cdm/json_web_key.h"
#include "media/media_buildflags.h"
#include "third_party/blink/public/platform/web_data.h" #include "third_party/blink/public/platform/web_data.h"
#include "third_party/blink/public/platform/web_encrypted_media_key_information.h" #include "third_party/blink/public/platform/web_encrypted_media_key_information.h"
#include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/platform/web_url.h" #include "third_party/blink/public/platform/web_url.h"
#include "third_party/blink/public/platform/web_vector.h" #include "third_party/blink/public/platform/web_vector.h"
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
#include "media/cdm/cenc_utils.h"
#endif
namespace media { namespace media {
namespace { namespace {
...@@ -107,17 +103,12 @@ bool SanitizeInitData(EmeInitDataType init_data_type, ...@@ -107,17 +103,12 @@ bool SanitizeInitData(EmeInitDataType init_data_type,
return true; return true;
case EmeInitDataType::CENC: case EmeInitDataType::CENC:
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
sanitized_init_data->assign(init_data, init_data + init_data_length); sanitized_init_data->assign(init_data, init_data + init_data_length);
if (!ValidatePsshInput(*sanitized_init_data)) { if (!ValidatePsshInput(*sanitized_init_data)) {
error_message->assign("Initialization data for CENC is incorrect."); error_message->assign("Initialization data for CENC is incorrect.");
return false; return false;
} }
return true; return true;
#else
error_message->assign("Initialization data type CENC is not supported.");
return false;
#endif
case EmeInitDataType::KEYIDS: { case EmeInitDataType::KEYIDS: {
// Extract the keys and then rebuild the message. This ensures that any // Extract the keys and then rebuild the message. This ensures that any
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment