Chromium Code Reviews| Index: net/base/mime_util.cc |
| diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc |
| index cba37a452b78662f3304120741f1ad840046010c..c2065622518d51611228d7226675d0e9bb48d304 100644 |
| --- a/net/base/mime_util.cc |
| +++ b/net/base/mime_util.cc |
| @@ -69,6 +69,11 @@ class MimeUtil : public PlatformMimeUtil { |
| VP8, |
| VP9, |
| THEORA |
| +#if defined(ENABLE_AC3_EAC3_AUDIO_DEMUXING) |
| + , |
| + AC3, |
| + EAC3 |
| +#endif |
| }; |
| bool GetMimeTypeFromExtension(const base::FilePath::StringType& ext, |
| @@ -491,6 +496,12 @@ static bool IsCodecSupportedOnAndroid(MimeUtil::Codec codec) { |
| // MPEG-2 variants of AAC are not supported on Android. |
| return false; |
| +#if defined(ENABLE_AC3_EAC3_AUDIO_DEMUXING) |
| + case MimeUtil::AC3: |
| + case MimeUtil::EAC3: |
| + return false; |
| +#endif |
| + |
| case MimeUtil::VP9: |
| // VP9 is supported only in KitKat+ (API Level 19). |
| return base::android::BuildInfo::GetInstance()->sdk_int() >= 19; |
| @@ -541,6 +552,9 @@ struct MediaFormatStrict { |
| // avc1.6400xx - H.264 High |
| static const char kMP4AudioCodecsExpression[] = |
| "mp4a.66,mp4a.67,mp4a.68,mp4a.69,mp4a.6B,mp4a.40.2,mp4a.40.02,mp4a.40.5," |
| +#if defined(ENABLE_AC3_EAC3_AUDIO_DEMUXING) |
| + "ac-3,ec-3,mp4a.a5,mp4a.a6," |
|
ddorwin
2015/02/26 20:49:32
You only need one each for AC3 and EAC3.
servolk
2015/02/26 22:00:59
Why? I believe these are just two different ways t
ddorwin
2015/02/26 22:06:18
Because this doesn't do what you think it does. (T
servolk
2015/02/26 22:29:20
Could you elaborate? As far as I can see this adds
ddorwin
2015/02/26 22:34:15
Yes, but format_codec_mappings is converted to enu
servolk
2015/02/26 22:43:54
Ah, ok, you are right, I missed the fact that they
|
| +#endif |
| "mp4a.40.05,mp4a.40.29"; |
| static const char kMP4VideoCodecsExpression[] = |
| "avc1.42E00A,avc1.4D400A,avc1.64000A," |
| @@ -588,6 +602,12 @@ static const CodecIDMappings kUnambiguousCodecIDs[] = { |
| {"mp4a.40.5", MimeUtil::MPEG4_AAC_SBR_v1}, |
| {"mp4a.40.05", MimeUtil::MPEG4_AAC_SBR_v1}, |
| {"mp4a.40.29", MimeUtil::MPEG4_AAC_SBR_PS_v2}, |
| +#if defined(ENABLE_AC3_EAC3_AUDIO_DEMUXING) |
| + {"ac-3", MimeUtil::AC3}, |
|
ddorwin
2015/02/26 20:49:32
Please add browser tests.
servolk
2015/02/27 01:21:14
Done.
|
| + {"ec-3", MimeUtil::EAC3}, |
| + {"mp4a.a5", MimeUtil::AC3}, |
| + {"mp4a.a6", MimeUtil::EAC3}, |
| +#endif |
| {"vorbis", MimeUtil::VORBIS}, |
| {"opus", MimeUtil::OPUS}, |
| {"vp8", MimeUtil::VP8}, |
| @@ -887,6 +907,13 @@ void MimeUtil::ParseCodecString(const std::string& codecs, |
| for (std::vector<std::string>::iterator it = codecs_out->begin(); |
| it != codecs_out->end(); |
| ++it) { |
| +#if defined(ENABLE_AC3_EAC3_AUDIO_DEMUXING) |
| + // We need to know the codec subtype to properly support AC3/EAC3. |
|
ddorwin
2015/02/26 20:49:32
Why is stripping okay? I don't think that is the i
servolk
2015/02/26 22:00:59
Actually I'm not sure about that myself, that just
|
| + // Do not strip the first '.' for mp4a.a5 and mp4a.a6. |
| + if (it->compare("mp4a.a5") == 0 || it->compare("mp4a.a6") == 0) { |
| + continue; |
| + } |
| +#endif |
| size_t found = it->find_first_of('.'); |
| if (found != std::string::npos) |
| it->resize(found); |
| @@ -1059,6 +1086,10 @@ bool MimeUtil::IsCodecProprietary(Codec codec) const { |
| case H264_BASELINE: |
| case H264_MAIN: |
| case H264_HIGH: |
| +#if defined(ENABLE_AC3_EAC3_AUDIO_DEMUXING) |
| + case AC3: |
| + case EAC3: |
| +#endif |
| return true; |
| case PCM: |