Index: media/filters/stream_parser_factory.cc |
diff --git a/media/filters/stream_parser_factory.cc b/media/filters/stream_parser_factory.cc |
index fd8e92bff0bb56785bcc08ec58e879ddad9d8985..382d608e6dda9d8f32fd770fc8fe5e73de4c71d2 100644 |
--- a/media/filters/stream_parser_factory.cc |
+++ b/media/filters/stream_parser_factory.cc |
@@ -50,7 +50,8 @@ struct CodecInfo { |
HISTOGRAM_EAC3, |
HISTOGRAM_MP3, |
HISTOGRAM_OPUS, |
- HISTOGRAM_MAX = HISTOGRAM_OPUS // Must be equal to largest logged entry. |
+ HISTOGRAM_AC3, |
+ HISTOGRAM_MAX = HISTOGRAM_AC3 // Must be equal to largest logged entry. |
}; |
const char* pattern; |
@@ -150,6 +151,21 @@ static const CodecInfo kMPEG4AACCodecInfo = { "mp4a.40.*", CodecInfo::AUDIO, |
static const CodecInfo kMPEG2AACLCCodecInfo = { "mp4a.67", CodecInfo::AUDIO, |
NULL, |
CodecInfo::HISTOGRAM_MPEG2AAC }; |
+#if defined(ENABLE_AC3_EAC3_AUDIO_DEMUXING) |
+// The 'ac-3' and 'ec-3' are mime codec ids for AC3 and EAC3 according to |
+// http://www.mp4ra.org/codecs.html |
+// The object types for AC3 and EAC3 in MP4 container are 0xa5 and 0xa6, so |
+// according to RFC 6381 this corresponds to codec ids 'mp4a.a5' and 'mp4a.a6'. |
+// Different applications use different codec ids. |
+static const CodecInfo kAC3CodecInfo1 = { "ac-3", CodecInfo::AUDIO, NULL, |
+ CodecInfo::HISTOGRAM_AC3 }; |
+static const CodecInfo kAC3CodecInfo2 = { "mp4a.a5", CodecInfo::AUDIO, NULL, |
+ CodecInfo::HISTOGRAM_AC3 }; |
+static const CodecInfo kEAC3CodecInfo1 = { "ec-3", CodecInfo::AUDIO, NULL, |
+ CodecInfo::HISTOGRAM_EAC3 }; |
+static const CodecInfo kEAC3CodecInfo2 = { "mp4a.a6", CodecInfo::AUDIO, NULL, |
+ CodecInfo::HISTOGRAM_EAC3 }; |
+#endif |
static const CodecInfo* kVideoMP4Codecs[] = { |
&kH264AVC1CodecInfo, |
@@ -162,6 +178,12 @@ static const CodecInfo* kVideoMP4Codecs[] = { |
static const CodecInfo* kAudioMP4Codecs[] = { |
&kMPEG4AACCodecInfo, |
&kMPEG2AACLCCodecInfo, |
+#if defined(ENABLE_AC3_EAC3_AUDIO_DEMUXING) |
+ &kAC3CodecInfo1, |
+ &kAC3CodecInfo2, |
+ &kEAC3CodecInfo1, |
+ &kEAC3CodecInfo2, |
+#endif |
NULL |
}; |
@@ -185,6 +207,14 @@ static StreamParser* BuildMP4Parser( |
has_sbr = true; |
break; |
} |
+#if defined(ENABLE_AC3_EAC3_AUDIO_DEMUXING) |
+ } else if (MatchPattern(codec_id, kAC3CodecInfo1.pattern) || |
+ MatchPattern(codec_id, kAC3CodecInfo2.pattern)) { |
+ audio_object_types.insert(mp4::kAC3); |
+ } else if (MatchPattern(codec_id, kEAC3CodecInfo1.pattern) || |
+ MatchPattern(codec_id, kEAC3CodecInfo2.pattern)) { |
+ audio_object_types.insert(mp4::kEAC3); |
+#endif |
} |
} |