Index: media/formats/mp4/mp4_stream_parser.cc |
diff --git a/media/formats/mp4/mp4_stream_parser.cc b/media/formats/mp4/mp4_stream_parser.cc |
index 78b7dcdae86fcda364f40f69d8404010e65c84cb..bab4029473cfe2d8807e333f6cea0201c4061841 100644 |
--- a/media/formats/mp4/mp4_stream_parser.cc |
+++ b/media/formats/mp4/mp4_stream_parser.cc |
@@ -216,9 +216,16 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) { |
const AudioSampleEntry& entry = samp_descr.audio_entries[desc_idx]; |
const AAC& aac = entry.esds.aac; |
- if (!(entry.format == FOURCC_MP4A || |
- (entry.format == FOURCC_ENCA && |
- entry.sinf.format.format == FOURCC_MP4A))) { |
+ FourCC audio_format = (entry.format == FOURCC_ENCA) |
+ ? entry.sinf.format.format |
+ : entry.format; |
+#if defined(ENABLE_AC3_EAC3_AUDIO_DEMUXING) |
+ if (audio_format != FOURCC_MP4A && audio_format != FOURCC_A52 && |
+ audio_format != FOURCC_A52b && audio_format != FOURCC_AC3 && |
+ audio_format != FOURCC_AC_3 && audio_format != FOURCC_EAC3) { |
+#else |
+ if (audio_format != FOURCC_MP4A) { |
+#endif |
MEDIA_LOG(ERROR, media_log_) << "Unsupported audio format 0x" |
<< std::hex << entry.format |
<< " in stsd box."; |
@@ -226,6 +233,17 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) { |
} |
uint8 audio_type = entry.esds.object_type; |
+#if defined(ENABLE_AC3_EAC3_AUDIO_DEMUXING) |
+ if (audio_type == kForbidden && |
+ (audio_format == FOURCC_EAC3 || audio_format == FOURCC_A52b)) { |
+ audio_type = kEAC3; |
+ } |
+ if (audio_type == kForbidden && |
+ (audio_format == FOURCC_A52 || audio_format == FOURCC_AC3 || |
+ audio_format == FOURCC_AC_3)) { |
+ audio_type = kAC3; |
+ } |
+#endif |
DVLOG(1) << "audio_type " << std::hex << static_cast<int>(audio_type); |
if (audio_object_types_.find(audio_type) == audio_object_types_.end()) { |
MEDIA_LOG(ERROR, media_log_) |
@@ -248,6 +266,16 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) { |
#if defined(OS_ANDROID) |
extra_data = aac.codec_specific_data(); |
#endif |
+#if defined(ENABLE_AC3_EAC3_AUDIO_DEMUXING) |
+ } else if (audio_type == kAC3) { |
+ codec = kCodecAC3; |
+ channel_layout = GuessChannelLayout(entry.channelcount); |
+ sample_per_second = entry.samplerate; |
+ } else if (audio_type == kEAC3) { |
+ codec = kCodecEAC3; |
+ channel_layout = GuessChannelLayout(entry.channelcount); |
+ sample_per_second = entry.samplerate; |
+#endif |
} else { |
MEDIA_LOG(ERROR, media_log_) << "Unsupported audio object type 0x" |
<< std::hex << audio_type << " in esds."; |