diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-04-05 17:15:33 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-04-11 07:47:18 +0000 |
commit | 7324afb043a0b1e623d8e8eb906cdc53bdeb4685 (patch) | |
tree | a3fe2d74ea9c9e142c390dac4ca0e219382ace46 /chromium/components/cdm | |
parent | 6a4cabb866f66d4128a97cdc6d9d08ce074f1247 (diff) | |
download | qtwebengine-chromium-7324afb043a0b1e623d8e8eb906cdc53bdeb4685.tar.gz |
BASELINE: Update Chromium to 58.0.3029.54
Change-Id: I67f57065a7afdc8e4614adb5c0230281428df4d1
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'chromium/components/cdm')
8 files changed, 61 insertions, 36 deletions
diff --git a/chromium/components/cdm/DEPS b/chromium/components/cdm/DEPS index cf0630df653..158aad01f08 100644 --- a/chromium/components/cdm/DEPS +++ b/chromium/components/cdm/DEPS @@ -2,5 +2,6 @@ include_rules = [ "+ipc", "+media/base", "+media/cdm", + "+media/media_features.h", "+ppapi/features", ] diff --git a/chromium/components/cdm/OWNERS b/chromium/components/cdm/OWNERS index 554a4be64a0..5ef846a40ff 100644 --- a/chromium/components/cdm/OWNERS +++ b/chromium/components/cdm/OWNERS @@ -1,2 +1,4 @@ ddorwin@chromium.org xhwang@chromium.org + +# COMPONENT: Internals>Media>Encrypted diff --git a/chromium/components/cdm/browser/cdm_message_filter_android.cc b/chromium/components/cdm/browser/cdm_message_filter_android.cc index e7f53716e00..849b716a379 100644 --- a/chromium/components/cdm/browser/cdm_message_filter_android.cc +++ b/chromium/components/cdm/browser/cdm_message_filter_android.cc @@ -14,6 +14,8 @@ #include "ipc/ipc_message_macros.h" #include "media/base/android/media_codec_util.h" #include "media/base/android/media_drm_bridge.h" +#include "media/base/audio_codecs.h" +#include "media/base/video_codecs.h" #include "media/media_features.h" using content::BrowserThread; @@ -24,30 +26,30 @@ namespace cdm { const size_t kMaxKeySystemLength = 256; -enum CodecType { - CODEC_AUDIO, - CODEC_VIDEO -}; - +template <typename CodecType> struct CodecInfo { - SupportedCodecs codec; - CodecType codec_type; - const char* codec_name; + SupportedCodecs eme_codec; + CodecType codec; const char* container_mime_type; }; -const CodecInfo kCodecsToQuery[] = { - {media::EME_CODEC_WEBM_OPUS, CODEC_AUDIO, "opus", "video/webm"}, - {media::EME_CODEC_WEBM_VORBIS, CODEC_AUDIO, "vorbis", "video/webm"}, - {media::EME_CODEC_WEBM_VP8, CODEC_VIDEO, "vp8", "video/webm"}, - {media::EME_CODEC_WEBM_VP9, CODEC_VIDEO, "vp9", "video/webm"}, -#if defined(USE_PROPRIETARY_CODECS) - {media::EME_CODEC_MP4_AAC, CODEC_AUDIO, "mp4a", "video/mp4"}, - {media::EME_CODEC_MP4_AVC1, CODEC_VIDEO, "avc1", "video/mp4"}, +const CodecInfo<media::VideoCodec> kVideoCodecsToQuery[] = { + {media::EME_CODEC_WEBM_VP8, media::kCodecVP8, "video/webm"}, + {media::EME_CODEC_WEBM_VP9, media::kCodecVP9, "video/webm"}, +#if BUILDFLAG(USE_PROPRIETARY_CODECS) + {media::EME_CODEC_MP4_AVC1, media::kCodecH264, "video/mp4"}, #if BUILDFLAG(ENABLE_HEVC_DEMUXING) - {media::EME_CODEC_MP4_HEVC, CODEC_VIDEO, "hvc1", "video/mp4"}, + {media::EME_CODEC_MP4_HEVC, media::kCodecHEVC, "video/mp4"}, #endif -#endif // defined(USE_PROPRIETARY_CODECS) +#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) +}; + +const CodecInfo<media::AudioCodec> kAudioCodecsToQuery[] = { + {media::EME_CODEC_WEBM_OPUS, media::kCodecOpus, "video/webm"}, + {media::EME_CODEC_WEBM_VORBIS, media::kCodecVorbis, "video/webm"}, +#if BUILDFLAG(USE_PROPRIETARY_CODECS) + {media::EME_CODEC_MP4_AAC, media::kCodecAAC, "video/mp4"}, +#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) }; static SupportedCodecs GetSupportedCodecs( @@ -56,17 +58,24 @@ static SupportedCodecs GetSupportedCodecs( const std::string& key_system = request.key_system; SupportedCodecs supported_codecs = media::EME_CODEC_NONE; - for (size_t i = 0; i < arraysize(kCodecsToQuery); ++i) { - const CodecInfo& info = kCodecsToQuery[i]; + for (const auto& info : kVideoCodecsToQuery) { // TODO(qinmin): Remove the composition logic when secure contents can be // composited. - bool is_secure = (info.codec_type == CODEC_VIDEO) - ? (!video_must_be_compositable) : false; - if ((request.codecs & info.codec) && + bool is_secure = !video_must_be_compositable; + if ((request.codecs & info.eme_codec) && + MediaDrmBridge::IsKeySystemSupportedWithType( + key_system, info.container_mime_type) && + media::MediaCodecUtil::CanDecode(info.codec, is_secure)) { + supported_codecs |= info.eme_codec; + } + } + + for (const auto& info : kAudioCodecsToQuery) { + if ((request.codecs & info.eme_codec) && MediaDrmBridge::IsKeySystemSupportedWithType( key_system, info.container_mime_type) && - media::MediaCodecUtil::CanDecode(info.codec_name, is_secure)) { - supported_codecs |= info.codec; + media::MediaCodecUtil::CanDecode(info.codec)) { + supported_codecs |= info.eme_codec; } } @@ -118,6 +127,9 @@ void CdmMessageFilterAndroid::OnQueryKeySystemSupport( // TODO(qinmin): check composition is supported or not. response->compositing_codecs = GetSupportedCodecs(request, true); response->non_compositing_codecs = GetSupportedCodecs(request, false); + + response->is_persistent_license_supported = + MediaDrmBridge::IsPersistentLicenseTypeSupported(request.key_system); } void CdmMessageFilterAndroid::OnGetPlatformKeySystemNames( diff --git a/chromium/components/cdm/common/cdm_messages_android.h b/chromium/components/cdm/common/cdm_messages_android.h index 028306ac35b..06104da658c 100644 --- a/chromium/components/cdm/common/cdm_messages_android.h +++ b/chromium/components/cdm/common/cdm_messages_android.h @@ -25,6 +25,7 @@ IPC_STRUCT_BEGIN(SupportedKeySystemResponse) IPC_STRUCT_MEMBER(media::SupportedCodecs, non_compositing_codecs, media::EME_CODEC_NONE) + IPC_STRUCT_MEMBER(bool, is_persistent_license_supported) IPC_STRUCT_END() // Messages sent from the renderer to the browser. diff --git a/chromium/components/cdm/common/widevine_drm_delegate_android.cc b/chromium/components/cdm/common/widevine_drm_delegate_android.cc index d8e0f439126..8c96a125872 100644 --- a/chromium/components/cdm/common/widevine_drm_delegate_android.cc +++ b/chromium/components/cdm/common/widevine_drm_delegate_android.cc @@ -6,6 +6,7 @@ #include "base/macros.h" #include "media/cdm/cenc_utils.h" +#include "media/media_features.h" namespace cdm { @@ -34,7 +35,7 @@ bool WidevineDrmDelegateAndroid::OnCreateSession( if (init_data_type != media::EmeInitDataType::CENC) return true; -#if defined(USE_PROPRIETARY_CODECS) +#if BUILDFLAG(USE_PROPRIETARY_CODECS) // Widevine MediaDrm plugin only accepts the "data" part of the PSSH box as // the init data when using MP4 container. return media::GetPsshData(init_data, GetUUID(), init_data_out); diff --git a/chromium/components/cdm/renderer/android_key_systems.cc b/chromium/components/cdm/renderer/android_key_systems.cc index 7953dd61f19..71706cfb2ce 100644 --- a/chromium/components/cdm/renderer/android_key_systems.cc +++ b/chromium/components/cdm/renderer/android_key_systems.cc @@ -14,6 +14,7 @@ #include "content/public/renderer/render_thread.h" #include "media/base/eme_constants.h" #include "media/base/media_switches.h" +#include "media/media_features.h" #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. @@ -48,11 +49,11 @@ class AndroidPlatformKeySystemProperties : public KeySystemProperties { case EmeInitDataType::WEBM: return (supported_codecs_ & media::EME_CODEC_WEBM_ALL) != 0; case EmeInitDataType::CENC: -#if defined(USE_PROPRIETARY_CODECS) +#if BUILDFLAG(USE_PROPRIETARY_CODECS) return (supported_codecs_ & media::EME_CODEC_MP4_ALL) != 0; #else return false; -#endif // defined(USE_PROPRIETARY_CODECS) +#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) case EmeInitDataType::KEYIDS: case EmeInitDataType::UNKNOWN: return false; @@ -115,8 +116,13 @@ void AddAndroidWidevine( kWidevineKeySystem); // Since we do not control the implementation of the MediaDrm API on Android, - // we assume that it can and will make use of persistence even though no - // persistence-based features are supported. + // we assume that it can and will make use of persistence no matter whether + // persistence-based features are supported or not. + + const EmeSessionTypeSupport persistent_license_support = + response.is_persistent_license_supported + ? EmeSessionTypeSupport::SUPPORTED_WITH_IDENTIFIER + : EmeSessionTypeSupport::NOT_SUPPORTED; if (response.compositing_codecs != media::EME_CODEC_NONE) { concrete_key_systems->emplace_back(new WidevineKeySystemProperties( @@ -124,7 +130,7 @@ void AddAndroidWidevine( response.non_compositing_codecs, // Hardware-secure codecs. Robustness::HW_SECURE_CRYPTO, // Max audio robustness. Robustness::HW_SECURE_ALL, // Max video robustness. - EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-license. + persistent_license_support, // persistent-license. EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-release-message. EmeFeatureSupport::ALWAYS_ENABLED, // Persistent state. EmeFeatureSupport::ALWAYS_ENABLED)); // Distinctive identifier. diff --git a/chromium/components/cdm/renderer/external_clear_key_key_system_properties.cc b/chromium/components/cdm/renderer/external_clear_key_key_system_properties.cc index 8e59f3558f0..b43b5c682a8 100644 --- a/chromium/components/cdm/renderer/external_clear_key_key_system_properties.cc +++ b/chromium/components/cdm/renderer/external_clear_key_key_system_properties.cc @@ -6,6 +6,7 @@ #include "base/logging.h" #include "media/base/eme_constants.h" +#include "media/media_features.h" #include "ppapi/features/features.h" namespace cdm { @@ -32,11 +33,11 @@ bool ExternalClearKeyProperties::IsSupportedInitDataType( return true; case media::EmeInitDataType::CENC: -#if defined(USE_PROPRIETARY_CODECS) +#if BUILDFLAG(USE_PROPRIETARY_CODECS) return true; #else return false; -#endif // defined(USE_PROPRIETARY_CODECS) +#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) case media::EmeInitDataType::UNKNOWN: return false; @@ -46,7 +47,7 @@ bool ExternalClearKeyProperties::IsSupportedInitDataType( } media::SupportedCodecs ExternalClearKeyProperties::GetSupportedCodecs() const { -#if defined(USE_PROPRIETARY_CODECS) +#if BUILDFLAG(USE_PROPRIETARY_CODECS) return media::EME_CODEC_MP4_ALL | media::EME_CODEC_WEBM_ALL; #else return media::EME_CODEC_WEBM_ALL; diff --git a/chromium/components/cdm/renderer/widevine_key_system_properties.cc b/chromium/components/cdm/renderer/widevine_key_system_properties.cc index 276f6238efa..c16e8e7828f 100644 --- a/chromium/components/cdm/renderer/widevine_key_system_properties.cc +++ b/chromium/components/cdm/renderer/widevine_key_system_properties.cc @@ -4,6 +4,7 @@ #include "components/cdm/renderer/widevine_key_system_properties.h" +#include "media/media_features.h" #include "ppapi/features/features.h" #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. @@ -72,10 +73,10 @@ bool WidevineKeySystemProperties::IsSupportedInitDataType( // |init_data_type| x |container| pairings. if (init_data_type == EmeInitDataType::WEBM) return (supported_codecs_ & media::EME_CODEC_WEBM_ALL) != 0; -#if defined(USE_PROPRIETARY_CODECS) +#if BUILDFLAG(USE_PROPRIETARY_CODECS) if (init_data_type == EmeInitDataType::CENC) return (supported_codecs_ & media::EME_CODEC_MP4_ALL) != 0; -#endif // defined(USE_PROPRIETARY_CODECS) +#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) return false; } |