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

Unified Diff: net/base/mime_util.cc

Issue 816353010: Implemented HEVC video demuxing and parsing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added hevc handling in media/base/android/media_codec_bridge.cc Created 5 years, 9 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: net/base/mime_util.cc
diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc
index 0b42b85920239bded4ff775fa81c2544b8889d36..d36ee4e19526aa910e7b76cd66812491756f54f4 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
@@ -466,6 +467,11 @@ static bool IsCodecSupportedOnAndroid(MimeUtil::Codec codec) {
case MimeUtil::VORBIS:
return true;
+ case MimeUtil::HEVC_MAIN:
+ // HEVC/H.265 is supported only in Lollipop+ (API Level 21). According to
ddorwin 2015/03/25 01:21:59 #if defined(ENABLE_HEVC_DEMUXING) ... #else retu
servolk 2015/03/25 02:20:21 Done.
+ // http://developer.android.com/reference/android/media/MediaFormat.html
+ return base::android::BuildInfo::GetInstance()->sdk_int() >= 21;
+
case MimeUtil::MPEG2_AAC_LC:
case MimeUtil::MPEG2_AAC_MAIN:
case MimeUtil::MPEG2_AAC_SSR:
@@ -520,6 +526,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";
@@ -1037,8 +1048,21 @@ 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
+ // ones that can't be added to the |string_to_codec_map_| and require parsing.
ddorwin 2015/03/25 01:21:59 nit: "can't be"? are not?
servolk 2015/03/25 02:20:20 Done.
+
+#if defined(ENABLE_HEVC_DEMUXING)
ddorwin 2015/03/25 01:21:59 Move this code to ParseHEVCCodecID or something li
servolk 2015/03/25 02:20:20 Done.
+ 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.
+ *codec = MimeUtil::HEVC_MAIN;
+ *is_ambiguous = false;
ddorwin 2015/03/25 01:21:59 This should be true since you do no verification.
servolk 2015/03/25 02:20:20 Done.
+ return true;
+ }
+#endif
+
return ParseH264CodecID(codec_id, codec, is_ambiguous);
}
@@ -1066,6 +1090,7 @@ bool MimeUtil::IsCodecProprietary(Codec codec) const {
case H264_BASELINE:
case H264_MAIN:
case H264_HIGH:
+ case HEVC_MAIN:
return true;
case PCM:
« media/filters/stream_parser_factory.cc ('K') | « media/test/data/bear-hevc-frag.mp4 ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698