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

Unified Diff: media/filters/decoder_stream_traits.cc

Issue 2466463005: Support (E)AC3 passthrough
Patch Set: Improve CastMediaClient::IsSupportedPassthroughAudio() Created 4 years, 1 month 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/filters/decoder_stream_traits.cc
diff --git a/media/filters/decoder_stream_traits.cc b/media/filters/decoder_stream_traits.cc
index deaedddc372ab73126eaf0f7ba183c2a716358e3..6e30ea6f0b768e5656bf75780fa8f384631cdabe 100644
--- a/media/filters/decoder_stream_traits.cc
+++ b/media/filters/decoder_stream_traits.cc
@@ -8,6 +8,7 @@
#include "media/base/audio_buffer.h"
#include "media/base/audio_decoder.h"
#include "media/base/audio_decoder_config.h"
+#include "media/base/media_client.h"
#include "media/base/video_decoder.h"
#include "media/base/video_frame.h"
@@ -24,8 +25,18 @@ void DecoderStreamTraits<DemuxerStream::AUDIO>::InitializeDecoder(
const InitCB& init_cb,
const OutputCB& output_cb) {
DCHECK(stream->audio_decoder_config().IsValidConfig());
- decoder->Initialize(stream->audio_decoder_config(), cdm_context, init_cb,
- output_cb);
+
+ AudioDecoderConfig config = stream->audio_decoder_config();
+ AudioCodec codec = config.codec();
+ MediaClient* media_client = GetMediaClient();
+ if (media_client && media_client->IsSupportedPassthroughAudio(codec)) {
+ config.Initialize(kCodecRaw, kSampleFormatRaw, config.channel_layout(),
+ config.samples_per_second(), config.extra_data(),
+ config.encryption_scheme(), config.seek_preroll(),
+ config.codec_delay());
+ }
+
+ decoder->Initialize(config, cdm_context, init_cb, output_cb);
}
bool DecoderStreamTraits<DemuxerStream::AUDIO>::NeedsBitstreamConversion(

Powered by Google App Engine
This is Rietveld 408576698