Chromium Code Reviews| Index: media/base/mime_util.cc |
| diff --git a/media/base/mime_util.cc b/media/base/mime_util.cc |
| index bc12773ca7bd1b16d041ce0c29d67b5f0283cec0..1cc28abb8c9c14086e1f8fa285a4a09808d58930 100644 |
| --- a/media/base/mime_util.cc |
| +++ b/media/base/mime_util.cc |
| @@ -36,6 +36,7 @@ class MimeUtil { |
| H264_BASELINE, |
| H264_MAIN, |
| H264_HIGH, |
| + HEVC_MAIN, |
|
ddorwin
2015/06/12 00:52:26
Is there a reason that "HEVC" is used instead of "
ddorwin
2015/06/12 00:52:26
Are there HEVC profiles other than main? Is that t
servolk
2015/06/12 21:57:31
There are 3 HEVC v1 profiles: main, main10 and mai
servolk
2015/06/12 21:57:31
Re this and your other comments on HEVC/H265. As f
|
| VP8, |
| VP9, |
| THEORA |
| @@ -199,6 +200,15 @@ static bool IsCodecSupportedOnAndroid(MimeUtil::Codec codec) { |
| case MimeUtil::VORBIS: |
| return true; |
| + case MimeUtil::HEVC_MAIN: |
| +#if defined(ENABLE_HEVC_DEMUXING) |
| + // HEVC/H.265 is supported only in Lollipop+ (API Level 21). According to |
|
ddorwin
2015/06/12 00:52:26
nit: remove "only"
s/. According/ according/
servolk
2015/06/12 21:57:31
Done.
|
| + // http://developer.android.com/reference/android/media/MediaFormat.html |
| + return base::android::BuildInfo::GetInstance()->sdk_int() >= 21; |
| +#else |
| + return false; |
| +#endif |
| + |
| case MimeUtil::MPEG2_AAC_LC: |
| case MimeUtil::MPEG2_AAC_MAIN: |
| case MimeUtil::MPEG2_AAC_SSR: |
| @@ -253,6 +263,11 @@ static const char kMP4VideoCodecsExpression[] = |
| // kUnambiguousCodecStringMap/kAmbiguousCodecStringMap should be the only |
| // mapping from strings to codecs. See crbug.com/461009. |
| "avc1.42E00A,avc1.4D400A,avc1.64000A," |
| +#if defined(ENABLE_HEVC_DEMUXING) |
| + // Any valid-looking HEVC string will work here, since these strings are |
| + // parsed and mapped to MimeUtil::Codec enum values. |
| + "hvc1.1.L0.0," |
| +#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"; |
| @@ -561,6 +576,26 @@ static bool ParseH264CodecID(const std::string& codec_id, |
| return true; |
| } |
| +#if defined(ENABLE_HEVC_DEMUXING) |
| +static bool ParseHEVCCodecID(const std::string& codec_id, |
| + MimeUtil::Codec* codec, |
| + bool* is_ambiguous) { |
| + if (StartsWithASCII(codec_id, "hev1.", true) || |
| + StartsWithASCII(codec_id, "hvc1.", true)) { |
| + // TODO(servolk): Implement parsing of hevc codec ids as described in |
| + // 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. |
| + // crbug.com/482761 |
| + *codec = MimeUtil::HEVC_MAIN; |
| + // Make this false for now to avoid dcheck at line 696 |
| + *is_ambiguous = false; |
|
ddorwin
2015/06/12 00:52:26
This isn't correct. I know it prevents the DCHECK,
servolk
2015/06/12 21:57:31
Ok, I've added a special case in this method, to e
|
| + return true; |
| + } |
| + |
| + return false; |
| +} |
| +#endif |
| + |
| bool MimeUtil::StringToCodec(const std::string& codec_id, |
| Codec* codec, |
| bool* is_ambiguous) const { |
| @@ -573,8 +608,13 @@ bool MimeUtil::StringToCodec(const std::string& codec_id, |
| } |
| // 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. |
| + // either H.264 or HEVC/H.265 codec ID because currently those are the only |
|
ddorwin
2015/06/12 00:52:26
ditto on mixing synonyms for the codecs. Also, why
servolk
2015/06/12 21:57:31
See above - yes, people would understand, but ment
|
| + // ones that are not added to the |string_to_codec_map_| and require parsing. |
| +#if defined(ENABLE_HEVC_DEMUXING) |
| + if (ParseHEVCCodecID(codec_id, codec, is_ambiguous)) { |
|
ddorwin
2015/06/12 00:52:26
Note: It seems wrong to check the less common code
servolk
2015/06/12 21:57:31
Acknowledged.
|
| + return true; |
| + } |
| +#endif |
| return ParseH264CodecID(codec_id, codec, is_ambiguous); |
| } |
| @@ -602,6 +642,7 @@ bool MimeUtil::IsCodecProprietary(Codec codec) const { |
| case H264_BASELINE: |
| case H264_MAIN: |
| case H264_HIGH: |
| + case HEVC_MAIN: |
| return true; |
| case PCM: |