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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/filters/decoder_stream_traits.h" 5 #include "media/filters/decoder_stream_traits.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "media/base/audio_buffer.h" 8 #include "media/base/audio_buffer.h"
9 #include "media/base/audio_decoder.h" 9 #include "media/base/audio_decoder.h"
10 #include "media/base/audio_decoder_config.h" 10 #include "media/base/audio_decoder_config.h"
11 #include "media/base/media_client.h"
11 #include "media/base/video_decoder.h" 12 #include "media/base/video_decoder.h"
12 #include "media/base/video_frame.h" 13 #include "media/base/video_frame.h"
13 14
14 namespace media { 15 namespace media {
15 16
16 std::string DecoderStreamTraits<DemuxerStream::AUDIO>::ToString() { 17 std::string DecoderStreamTraits<DemuxerStream::AUDIO>::ToString() {
17 return "audio"; 18 return "audio";
18 } 19 }
19 20
20 void DecoderStreamTraits<DemuxerStream::AUDIO>::InitializeDecoder( 21 void DecoderStreamTraits<DemuxerStream::AUDIO>::InitializeDecoder(
21 DecoderType* decoder, 22 DecoderType* decoder,
22 DemuxerStream* stream, 23 DemuxerStream* stream,
23 CdmContext* cdm_context, 24 CdmContext* cdm_context,
24 const InitCB& init_cb, 25 const InitCB& init_cb,
25 const OutputCB& output_cb) { 26 const OutputCB& output_cb) {
26 DCHECK(stream->audio_decoder_config().IsValidConfig()); 27 DCHECK(stream->audio_decoder_config().IsValidConfig());
27 decoder->Initialize(stream->audio_decoder_config(), cdm_context, init_cb, 28
28 output_cb); 29 AudioDecoderConfig config = stream->audio_decoder_config();
30 AudioCodec codec = config.codec();
31 MediaClient* media_client = GetMediaClient();
32 if (media_client && media_client->IsSupportedPassthroughAudio(codec)) {
33 config.Initialize(kCodecRaw, kSampleFormatRaw, config.channel_layout(),
34 config.samples_per_second(), config.extra_data(),
35 config.encryption_scheme(), config.seek_preroll(),
36 config.codec_delay());
37 }
38
39 decoder->Initialize(config, cdm_context, init_cb, output_cb);
29 } 40 }
30 41
31 bool DecoderStreamTraits<DemuxerStream::AUDIO>::NeedsBitstreamConversion( 42 bool DecoderStreamTraits<DemuxerStream::AUDIO>::NeedsBitstreamConversion(
32 DecoderType* decoder) { 43 DecoderType* decoder) {
33 return decoder->NeedsBitstreamConversion(); 44 return decoder->NeedsBitstreamConversion();
34 } 45 }
35 46
36 void DecoderStreamTraits<DemuxerStream::AUDIO>::ReportStatistics( 47 void DecoderStreamTraits<DemuxerStream::AUDIO>::ReportStatistics(
37 const StatisticsCB& statistics_cb, 48 const StatisticsCB& statistics_cb,
38 int bytes_decoded) { 49 int bytes_decoded) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 const scoped_refptr<DecoderBuffer>& buffer) { 108 const scoped_refptr<DecoderBuffer>& buffer) {
98 audio_ts_validator_->CheckForTimestampGap(buffer); 109 audio_ts_validator_->CheckForTimestampGap(buffer);
99 } 110 }
100 111
101 void DecoderStreamTraits<DemuxerStream::AUDIO>::OnDecodeDone( 112 void DecoderStreamTraits<DemuxerStream::AUDIO>::OnDecodeDone(
102 const scoped_refptr<OutputType>& buffer) { 113 const scoped_refptr<OutputType>& buffer) {
103 audio_ts_validator_->RecordOutputDuration(buffer); 114 audio_ts_validator_->RecordOutputDuration(buffer);
104 } 115 }
105 116
106 } // namespace media 117 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698