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

Unified Diff: media/mp4/mp4_stream_parser.cc

Issue 14641006: Support EAC3 (Dolby Digital Plus) codec (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sytle-fix Created 7 years, 8 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
« media/filters/stream_parser_factory.cc ('K') | « media/mp4/fourccs.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mp4/mp4_stream_parser.cc
diff --git a/media/mp4/mp4_stream_parser.cc b/media/mp4/mp4_stream_parser.cc
index 19096006b06acffc10654a4829baed3b9f65e81d..6c5c8123041f5b0f6ec99d5c2012613655d1838f 100644
--- a/media/mp4/mp4_stream_parser.cc
+++ b/media/mp4/mp4_stream_parser.cc
@@ -199,7 +199,11 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
if (!(entry.format == FOURCC_MP4A ||
(entry.format == FOURCC_ENCA &&
- entry.sinf.format.format == FOURCC_MP4A))) {
+ entry.sinf.format.format == FOURCC_MP4A)
+#if defined(ENABLE_EAC3_PLAYBACK)
acolwell GONE FROM CHROMIUM 2013/04/30 18:43:43 I think we should just drop the #if's in this file
ycheo (away) 2013/05/01 00:05:46 Done.
+ || entry.format == FOURCC_EAC3
+#endif
+ )) {
MEDIA_LOG(log_cb_) << "Unsupported audio format 0x"
<< std::hex << entry.format << " in stsd box.";
return false;
@@ -207,6 +211,12 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
int audio_type = entry.esds.object_type;
DVLOG(1) << "audio_type " << std::hex << audio_type;
+#if defined(ENABLE_EAC3_PLAYBACK)
+ if (audio_type == kForbidden &&
+ audio_object_types_.find(kEAC3) != audio_object_types_.end()) {
+ audio_type = kEAC3;
+ }
+#endif
if (audio_object_types_.find(audio_type) == audio_object_types_.end()) {
MEDIA_LOG(log_cb_) << "audio object type 0x" << std::hex << audio_type
<< " does not match what is specified in the"
@@ -214,9 +224,16 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
return false;
}
+ AudioCodec codec = kUnknownAudioCodec;
// Check if it is MPEG4 AAC defined in ISO 14496 Part 3 or
// supported MPEG2 AAC varients.
- if (audio_type != kISO_14496_3 && audio_type != kISO_13818_7_AAC_LC) {
+ if (audio_type == kISO_14496_3 || audio_type == kISO_13818_7_AAC_LC) {
+ codec = kCodecAAC;
+#if defined(ENABLE_EAC3_PLAYBACK)
+ } else if (audio_type == kEAC3) {
+ codec = kCodecEAC3;
+#endif
+ } else {
MEDIA_LOG(log_cb_) << "Unsupported audio object type 0x" << std::hex
<< audio_type << " in esds.";
return false;
@@ -234,11 +251,21 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
return false;
}
+ ChannelLayout channel_layout = aac.GetChannelLayout(has_sbr_);
+ if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED &&
+ entry.channelcount > 0) {
acolwell GONE FROM CHROMIUM 2013/04/30 18:19:02 Should this logic be moved above where 'codec' is
ycheo (away) 2013/05/01 00:05:46 Done.
+ channel_layout = GuessChannelLayout(entry.channelcount);
+ }
+
+ int sample_per_second = aac.GetOutputSamplesPerSecond(has_sbr_);
+ if (sample_per_second == 0 && entry.samplerate > 0)
+ sample_per_second = entry.samplerate;
+
is_audio_track_encrypted_ = entry.sinf.info.track_encryption.is_encrypted;
DVLOG(1) << "is_audio_track_encrypted_: " << is_audio_track_encrypted_;
- audio_config.Initialize(kCodecAAC, sample_format,
- aac.GetChannelLayout(has_sbr_),
- aac.GetOutputSamplesPerSecond(has_sbr_),
+ audio_config.Initialize(codec, sample_format,
+ channel_layout,
+ sample_per_second,
NULL, 0, is_audio_track_encrypted_, false);
has_audio_ = true;
audio_track_id_ = track->header.track_id;
@@ -455,7 +482,8 @@ bool MP4StreamParser::EnqueueSample(BufferQueue* audio_buffers,
}
if (audio) {
- if (!PrepareAACBuffer(runs_->audio_description().esds.aac,
+ if (runs_->audio_description().esds.object_type != kForbidden &&
acolwell GONE FROM CHROMIUM 2013/04/30 18:19:02 nit: How about adding a isAAC() helper method to e
ycheo (away) 2013/05/01 00:05:46 Done.
+ !PrepareAACBuffer(runs_->audio_description().esds.aac,
&frame_buf, &subsamples)) {
MEDIA_LOG(log_cb_) << "Failed to prepare AAC sample for decode";
*err = true;
« media/filters/stream_parser_factory.cc ('K') | « media/mp4/fourccs.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698