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

Unified Diff: media/base/mime_util_internal.cc

Issue 1677133003: Implemented parsing of HEVC codec ids (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@parse-codec-id
Patch Set: Fixed unit test Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: media/base/mime_util_internal.cc
diff --git a/media/base/mime_util_internal.cc b/media/base/mime_util_internal.cc
index 7901721adf34d340e311811e3ea41bef4700611d..73b13afc42344480e82416ebd33098bfeefecd41 100644
--- a/media/base/mime_util_internal.cc
+++ b/media/base/mime_util_internal.cc
@@ -229,42 +229,6 @@ static bool IsValidH264Level(uint8_t level_idc) {
(level_idc >= 50 && level_idc <= 51));
}
-#if BUILDFLAG(ENABLE_HEVC_DEMUXING)
-// ISO/IEC FDIS 14496-15 standard section E.3 describes the syntax of codec ids
-// reserved for HEVC. According to that spec HEVC codec id must start with
-// either "hev1." or "hvc1.". We don't yet support full parsing of HEVC codec
-// ids, but since no other codec id starts with those string we'll just treat
-// any string starting with "hev1." or "hvc1." as valid HEVC codec ids.
-// crbug.com/482761
-static bool ParseHEVCCodecID(const std::string& codec_id,
- MimeUtil::Codec* codec,
- bool* is_ambiguous) {
- if (base::StartsWith(codec_id, "hev1.", base::CompareCase::SENSITIVE) ||
- base::StartsWith(codec_id, "hvc1.", base::CompareCase::SENSITIVE)) {
- *codec = MimeUtil::HEVC_MAIN;
-
- // TODO(servolk): Full HEVC codec id parsing is not implemented yet (see
- // crbug.com/482761). So treat HEVC codec ids as ambiguous for now.
- *is_ambiguous = true;
-
- // TODO(servolk): Most HEVC codec ids are treated as ambiguous (see above),
- // but we need to recognize at least one valid unambiguous HEVC codec id,
- // which is added into kMP4VideoCodecsExpression. We need it to be
- // unambiguous to avoid DCHECK(!is_ambiguous) in InitializeMimeTypeMaps. We
- // also use these in unit tests (see
- // content/browser/media/media_canplaytype_browsertest.cc).
- // Remove this workaround after crbug.com/482761 is fixed.
- if (codec_id == "hev1.1.6.L93.B0" || codec_id == "hvc1.1.6.L93.B0") {
- *is_ambiguous = false;
- }
-
- return true;
- }
-
- return false;
-}
-#endif
-
MimeUtil::MimeUtil() : allow_proprietary_codecs_(false) {
InitializeMimeTypeMaps();
}
@@ -422,15 +386,17 @@ bool MimeUtil::StringToCodec(const std::string& codec_id,
// If |codec_id| is not in |string_to_codec_map_|, then we assume that it is
// either H.264 or HEVC/H.265 codec ID because currently those are the only
// ones that are not added to the |string_to_codec_map_| and require parsing.
+ VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN;
+ uint8_t level_idc = 0;
#if BUILDFLAG(ENABLE_HEVC_DEMUXING)
- if (ParseHEVCCodecID(codec_id, codec, is_ambiguous)) {
+ if (ParseHEVCCodecId(codec_id, &profile, &level_idc)) {
+ *is_ambiguous = false;
+ *codec = MimeUtil::HEVC;
return true;
}
#endif
- VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN;
- uint8_t level_idc = 0;
if (ParseAVCCodecId(codec_id, &profile, &level_idc)) {
*codec = MimeUtil::H264;
*is_ambiguous =
@@ -468,7 +434,7 @@ bool MimeUtil::IsCodecProprietary(Codec codec) const {
case MPEG4_AAC_SBR_v1:
case MPEG4_AAC_SBR_PS_v2:
case H264:
- case HEVC_MAIN:
+ case HEVC:
return true;
case PCM:
@@ -539,7 +505,7 @@ bool MimeUtil::IsCodecSupportedOnAndroid(Codec codec) const {
// Opus is supported only in Lollipop+ (API Level 21).
return base::android::BuildInfo::GetInstance()->sdk_int() >= 21;
- case HEVC_MAIN:
+ case HEVC:
#if BUILDFLAG(ENABLE_HEVC_DEMUXING)
// HEVC/H.265 is supported in Lollipop+ (API Level 21), according to
// http://developer.android.com/reference/android/media/MediaFormat.html

Powered by Google App Engine
This is Rietveld 408576698