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

Unified Diff: media/formats/mp4/mp4_stream_parser.cc

Issue 812643005: Re-add AC3/EAC3 audio demuxing support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years 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: 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 af64343b6237d21e5b7654febc418b36cadaa2f2..c1102f4f031e67d72496111055be3136e8605803 100644
--- a/media/formats/mp4/mp4_stream_parser.cc
+++ b/media/formats/mp4/mp4_stream_parser.cc
@@ -217,9 +217,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)
ddorwin 2016/01/04 23:22:17 If you can provide some context on this (basically
servolk 2016/01/07 02:30:04 FOURCC_ENCA just means that audio stream is encryp
+ ? entry.sinf.format.format
+ : entry.format;
ddorwin 2016/01/04 23:22:17 nit: Empty line after since this is it's own chunk
servolk 2016/01/07 02:30:04 Done.
+#if defined(ENABLE_AC3_EAC3_AUDIO_DEMUXING)
+ if (audio_format != FOURCC_MP4A && audio_format != FOURCC_A52 &&
ddorwin 2016/01/04 23:22:17 I think a switch statement will be cleaner and avo
servolk 2016/01/07 02:30:04 Now that I've removed a52/a52b the ifs are only fo
+ audio_format != FOURCC_A52b && audio_format != FOURCC_AC3 &&
ddorwin 2016/01/04 23:22:17 I see AC3 and EAC3 values are mixed here. Should t
servolk 2016/01/07 02:30:04 Now, with only one value for AC3/EAC3 each, this l
+ 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.";
@@ -227,6 +234,17 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
}
uint8_t audio_type = entry.esds.object_type;
+#if defined(ENABLE_AC3_EAC3_AUDIO_DEMUXING)
+ if (audio_type == kForbidden &&
ddorwin 2016/01/04 23:22:17 No need to duplicate the kForbidden check. Put eve
servolk 2016/01/07 02:30:04 kForbidden means the mp4 parser used by MSE doesn'
+ (audio_format == FOURCC_EAC3 || audio_format == FOURCC_A52b)) {
ddorwin 2016/01/04 23:22:17 With the change above, a switch statement probably
servolk 2016/01/07 02:30:04 Now that we have only two values, I believe if sho
+ audio_type = kEAC3;
+ }
+ if (audio_type == kForbidden &&
+ (audio_format == FOURCC_A52 || audio_format == FOURCC_AC3 ||
ddorwin 2016/01/04 23:22:17 AC3 has been before EAC3 except here.
servolk 2016/01/07 02:30:04 Fixed the ordering above. AC3 should be before EAC
+ 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_)
@@ -249,6 +267,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.";

Powered by Google App Engine
This is Rietveld 408576698