 Chromium Code Reviews
 Chromium Code Reviews Issue 816353010:
  Implemented HEVC video demuxing and parsing  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 816353010:
  Implemented HEVC video demuxing and parsing  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| Index: net/base/mime_util.cc | 
| diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc | 
| index a7fe9f3eea57b099becd42f0b45ad61bbe883738..c4aab5a3e26879bc8675452102462934a275d139 100644 | 
| --- a/net/base/mime_util.cc | 
| +++ b/net/base/mime_util.cc | 
| @@ -45,6 +45,7 @@ class MimeUtil : public PlatformMimeUtil { | 
| H264_BASELINE, | 
| H264_MAIN, | 
| H264_HIGH, | 
| + HEVC_MAIN, | 
| VP8, | 
| VP9, | 
| THEORA | 
| @@ -464,6 +465,9 @@ static bool IsCodecSupportedOnAndroid(MimeUtil::Codec codec) { | 
| case MimeUtil::VORBIS: | 
| return true; | 
| + case MimeUtil::HEVC_MAIN: | 
| + return false; | 
| + | 
| case MimeUtil::MPEG2_AAC_LC: | 
| case MimeUtil::MPEG2_AAC_MAIN: | 
| case MimeUtil::MPEG2_AAC_SSR: | 
| @@ -523,6 +527,9 @@ static const char kMP4AudioCodecsExpression[] = | 
| "mp4a.40.05,mp4a.40.29"; | 
| static const char kMP4VideoCodecsExpression[] = | 
| "avc1.42E00A,avc1.4D400A,avc1.64000A," | 
| +#if defined(ENABLE_HEVC_DEMUXING) | 
| 
ddorwin
2015/02/21 02:09:21
"DEMUXING" is not really accurate. This enables su
 
servolk
2015/02/23 19:16:16
No, I believe this is accurate. What exactly do yo
 
ddorwin
2015/02/23 20:00:49
The primary "support" it enables is advertising su
 
servolk
2015/02/24 02:15:13
Yes, this does enable hevc support via canPlayType
 
ddorwin
2015/02/24 18:07:33
Agreed. My point is that this flag enables HEVC, n
 | 
| + "hev1,hvc1," | 
| 
ddorwin
2015/02/21 02:09:21
See below.
 
ddorwin
2015/02/23 20:00:49
See some of the comments about how avc1 is handled
 
ddorwin
2015/02/23 20:12:43
Note that you must have an unambiguous string or y
 
servolk
2015/02/24 02:15:13
Wait, I don't understand - even in that CL we have
 
ddorwin
2015/02/24 18:07:33
I didn't change anything in that CL, I just explai
 | 
| +#endif | 
| "mp4a.66,mp4a.67,mp4a.68,mp4a.69,mp4a.6B,mp4a.40.2,mp4a.40.02,mp4a.40.5," | 
| "mp4a.40.05,mp4a.40.29"; | 
| @@ -556,6 +563,10 @@ struct CodecIDMappings { | 
| // The "mp4a" strings come from RFC 6381. | 
| static const CodecIDMappings kUnambiguousCodecIDs[] = { | 
| {"1", MimeUtil::PCM}, // We only allow this for WAV so it isn't ambiguous. | 
| +#if defined(ENABLE_HEVC_DEMUXING) | 
| + {"hev1", MimeUtil::HEVC_MAIN}, | 
| 
ddorwin
2015/02/21 02:09:21
I don't think we should support these extension-le
 
ddorwin
2015/02/21 02:44:40
To clarify, this may not have been so much a mista
 
servolk
2015/02/23 19:16:16
As far as I know the difference between hev1 and h
 
ddorwin
2015/02/23 20:00:50
Thanks for the exmplanation of "hev" vs. "hvc". I
 
ddorwin
2015/02/23 20:12:43
Oops, strike that. Because we do not want to suppo
 | 
| + {"hvc1", MimeUtil::HEVC_MAIN}, | 
| +#endif | 
| {"mp3", MimeUtil::MP3}, | 
| {"mp4a.66", MimeUtil::MPEG2_AAC_MAIN}, | 
| {"mp4a.67", MimeUtil::MPEG2_AAC_LC}, | 
| @@ -1008,6 +1019,18 @@ bool MimeUtil::StringToCodec(const std::string& codec_id, | 
| return true; | 
| } | 
| +#if defined(ENABLE_HEVC_DEMUXING) | 
| 
ddorwin
2015/02/23 20:00:49
Move this code to ParseHEVCCodecID or something li
 | 
| + if (StartsWithASCII(codec_id, "hev1.", true) || | 
| 
ddorwin
2015/02/21 02:09:21
Once the other issues are addressed, you'll need t
 
servolk
2015/02/23 19:16:16
Ok, yeah, once we have more clarity here we'll try
 
ddorwin
2015/02/23 20:00:49
You should add at least some basic tests soon. Thi
 
servolk
2015/02/24 02:15:13
Sure, I will add some tests. In fact I've already
 
ddorwin
2015/02/24 18:07:32
I think we have pipeline tests and content and chr
 | 
| + StartsWithASCII(codec_id, "hvc1.", true)) { | 
| + // TODO(servolk): Implement parsing of hevc codec ids as described in | 
| 
ddorwin
2015/02/21 02:09:21
Our avc1 string handling is a mess. Similar to my
 
servolk
2015/02/23 19:16:16
I understand your concerns, but we are in the earl
 
ddorwin
2015/02/23 20:00:49
Can we at least check for valid values, similar to
 
servolk
2015/02/24 02:15:13
Yep, will do
 | 
| + // ETSI TS 126 244 standard section A.2.2, but for now allow any | 
| + // HEVC tiers/profiles and let decoder decide if it can handle that. | 
| + *codec = MimeUtil::HEVC_MAIN; | 
| + *is_ambiguous = false; | 
| 
ddorwin
2015/02/21 02:09:21
This should be true since you do no verification.
 
servolk
2015/02/23 19:16:16
yep, that's a good point, I'll change this.
 | 
| + return true; | 
| + } | 
| +#endif | 
| + | 
| // If |codec_id| is not in |string_to_codec_map_|, then we assume that it is | 
| // an H.264 codec ID because currently those are the only ones that can't be | 
| // stored in the |string_to_codec_map_| and require parsing. | 
| @@ -1038,6 +1061,7 @@ bool MimeUtil::IsCodecProprietary(Codec codec) const { | 
| case H264_BASELINE: | 
| case H264_MAIN: | 
| case H264_HIGH: | 
| + case HEVC_MAIN: | 
| return true; | 
| case PCM: |