Index: media/base/mime_util_internal.cc |
diff --git a/media/base/mime_util_internal.cc b/media/base/mime_util_internal.cc |
index 882ccb7ac490426f4ff298669dabdd299f5e8b66..d0f2a8f405d97a254304128564a354a48f9e95a5 100644 |
--- a/media/base/mime_util_internal.cc |
+++ b/media/base/mime_util_internal.cc |
@@ -149,42 +149,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) { |
#if defined(OS_ANDROID) |
platform_info_.is_unified_media_pipeline_enabled = |
@@ -298,7 +262,7 @@ void MimeUtil::AddSupportedMediaFormats() { |
CodecSet mp4_video_codecs; |
mp4_video_codecs.insert(H264); |
#if BUILDFLAG(ENABLE_HEVC_DEMUXING) |
- mp4_video_codecs.insert(HEVC_MAIN); |
+ mp4_video_codecs.insert(HEVC); |
#endif // BUILDFLAG(ENABLE_HEVC_DEMUXING) |
CodecSet mp4_codecs(mp4_audio_codecs); |
mp4_codecs.insert(mp4_video_codecs.begin(), mp4_video_codecs.end()); |
@@ -517,7 +481,7 @@ bool MimeUtil::IsCodecSupportedOnPlatform( |
DCHECK(!is_encrypted || platform_info.has_platform_decoders); |
return true; |
- case HEVC_MAIN: |
+ case HEVC: |
#if BUILDFLAG(ENABLE_HEVC_DEMUXING) |
if (platform_info.is_unified_media_pipeline_enabled && |
!platform_info.has_platform_decoders) { |
@@ -575,15 +539,9 @@ 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. |
- |
-#if BUILDFLAG(ENABLE_HEVC_DEMUXING) |
- if (ParseHEVCCodecID(codec_id, codec, is_ambiguous)) { |
- return true; |
- } |
-#endif |
- |
VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN; |
uint8_t level_idc = 0; |
+ |
if (ParseAVCCodecId(codec_id, &profile, &level_idc)) { |
*codec = MimeUtil::H264; |
switch (profile) { |
@@ -611,6 +569,18 @@ bool MimeUtil::StringToCodec(const std::string& codec_id, |
return true; |
} |
+#if BUILDFLAG(ENABLE_HEVC_DEMUXING) |
+ if (ParseHEVCCodecId(codec_id, &profile, &level_idc)) { |
+ // TODO(servolk): Set |is_ambiguous| to false for now to make sure |
+ // CanPlayType result is 'probably' and not 'maybe', since that's what unit |
+ // tests expect. We'll need to add platform level checks to ensure that the |
ddorwin
2016/04/07 20:29:46
What tests expect 'probably'? Can't we just update
servolk
2016/04/07 20:44:03
The MediaCanPlayTypeTest.CodecSupportTest_HEVCVari
ddorwin
2016/04/08 20:43:24
If there are profiles, level, etc. combinations th
servolk
2016/04/08 22:11:45
Done.
|
+ // given combination of HEVC profile and level is actually supported. |
+ *is_ambiguous = false; |
+ *codec = MimeUtil::HEVC; |
+ return true; |
+ } |
+#endif |
+ |
DVLOG(4) << __FUNCTION__ << ": Unrecognized codec id " << codec_id; |
return false; |
} |
@@ -639,7 +609,7 @@ bool MimeUtil::IsCodecProprietary(Codec codec) const { |
case MPEG2_AAC: |
case MPEG4_AAC: |
case H264: |
- case HEVC_MAIN: |
+ case HEVC: |
return true; |
case PCM: |