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

Unified Diff: media/ffmpeg/ffmpeg_common.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/ffmpeg/ffmpeg_common.cc
diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc
index 88c29b19e2275f1a5cbf6eec14b0a4ae41d69ed8..d36d7f63dafb7046667c0abcdaa379b76c59e2e7 100644
--- a/media/ffmpeg/ffmpeg_common.cc
+++ b/media/ffmpeg/ffmpeg_common.cc
@@ -66,6 +66,12 @@ static AudioCodec CodecIDToAudioCodec(AVCodecID codec_id) {
switch (codec_id) {
case AV_CODEC_ID_AAC:
return kCodecAAC;
+#if defined(ENABLE_AC3_EAC3_AUDIO_DEMUXING)
+ case AV_CODEC_ID_AC3:
+ return kCodecAC3;
+ case AV_CODEC_ID_EAC3:
+ return kCodecEAC3;
+#endif
case AV_CODEC_ID_MP3:
return kCodecMP3;
case AV_CODEC_ID_VORBIS:
@@ -301,8 +307,12 @@ bool AVCodecContextToAudioDecoderConfig(const AVCodecContext* codec_context,
AudioCodec codec = CodecIDToAudioCodec(codec_context->codec_id);
- SampleFormat sample_format = AVSampleFormatToSampleFormat(
- codec_context->sample_fmt, codec_context->codec_id);
+ // For AC3/EAC3, FFmpeg does not fill |sample_fmt|.
ddorwin 2016/01/04 23:22:17 Is this a bug that should be fixed upstream or bec
servolk 2016/01/07 02:30:03 That's because we don't enable decoder, to avoid a
+ SampleFormat sample_format =
+ (codec == kCodecAC3 || codec == kCodecEAC3)
+ ? kSampleFormatS16
ddorwin 2016/01/04 23:22:17 How do we know S16 is always correct?
servolk 2016/01/07 02:30:03 The spec for AC3/EAC3 audio is ETSI TS 102 366: ht
+ : AVSampleFormatToSampleFormat(codec_context->sample_fmt,
+ codec_context->codec_id);
ChannelLayout channel_layout = ChannelLayoutToChromeChannelLayout(
codec_context->channel_layout, codec_context->channels);
@@ -351,8 +361,7 @@ bool AVCodecContextToAudioDecoderConfig(const AVCodecContext* codec_context,
is_encrypted,
seek_preroll,
codec_context->delay);
-
- if (codec != kCodecOpus) {
+ if (codec != kCodecOpus && codec != kCodecAC3 && codec != kCodecEAC3) {
ddorwin 2016/01/04 23:22:17 I assume this is for the same reasons. Perhaps ref
servolk 2016/01/07 02:30:04 I think a switch would be awkward here, it would h
DCHECK_EQ(av_get_bytes_per_sample(codec_context->sample_fmt) * 8,
config->bits_per_channel());
}

Powered by Google App Engine
This is Rietveld 408576698