Commit d4a6a9c5 authored by Jeffrey Kardatzke's avatar Jeffrey Kardatzke Committed by Chromium LUCI CQ

Relocate encrypted HEVC mime checking code

BUG=b:153111783
TEST=Encrypted HEVC playback works w/ clear testing flag enabled

Change-Id: I08372658b04c2cadf2b6d032e619406ea05516e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2587521
Commit-Queue: Jeffrey Kardatzke <jkardatzke@google.com>
Commit-Queue: Chrome Cunningham <chcunningham@chromium.org>
Reviewed-by: default avatarChrome Cunningham <chcunningham@chromium.org>
Auto-Submit: Jeffrey Kardatzke <jkardatzke@google.com>
Cr-Commit-Position: refs/heads/master@{#836735}
parent d813b92c
......@@ -915,14 +915,6 @@ SupportsType MimeUtil::IsCodecSupported(const std::string& mime_type_lower_case,
return IsNotSupported;
}
#if BUILDFLAG(USE_CHROMEOS_PROTECTED_MEDIA)
if (codec == MimeUtil::HEVC && is_encrypted &&
(video_profile == HEVCPROFILE_MAIN ||
video_profile == HEVCPROFILE_MAIN10)) {
return IsSupported;
}
#endif // BUILDFLAG(USE_CHROMEOS_PROTECTED_MEDIA)
if (video_codec != kUnknownVideoCodec) {
if (!IsSupportedVideoType(
{video_codec, video_profile, video_level, color_space})) {
......
......@@ -19,6 +19,7 @@
#include "media/base/logging_override_if_enabled.h"
#include "media/base/media_permission.h"
#include "media/base/mime_util.h"
#include "media/media_buildflags.h"
#include "third_party/blink/public/platform/url_conversion.h"
#include "third_party/blink/public/platform/web_media_key_system_configuration.h"
#include "third_party/blink/public/platform/web_string.h"
......@@ -160,6 +161,32 @@ bool IsSupportedMediaType(const std::string& container_mime_type,
std::vector<std::string> codec_vector;
SplitCodecs(codecs, &codec_vector);
#if BUILDFLAG(ENABLE_PLATFORM_HEVC) && BUILDFLAG(USE_CHROMEOS_PROTECTED_MEDIA)
// EME HEVC is supported on CrOS under these build flags, but it is not
// supported for clear playback. Remove the HEVC codec strings to avoid asking
// IsSupported*MediaFormat() about HEVC. EME support for HEVC profiles
// is described via KeySystemProperties::GetSupportedCodecs().
// TODO(1156282): Decouple the rest of clear vs EME codec support.
if (base::ToLowerASCII(container_mime_type) == "video/mp4" &&
!codec_vector.empty()) {
auto it = codec_vector.begin();
while (it != codec_vector.end()) {
VideoCodecProfile profile;
uint8_t level_idc;
if (ParseHEVCCodecId(*it, &profile, &level_idc))
codec_vector.erase(it);
else
++it;
}
// Avoid calling IsSupported*MediaFormat() with an empty vector. For
// "video/mp4", this will return MaybeSupported, which we would otherwise
// consider "false" below.
if (codec_vector.empty())
return true;
}
#endif
// AesDecryptor decrypts the stream in the demuxer before it reaches the
// decoder so check whether the media format is supported when clear.
SupportsType support_result =
......
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