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

Side by Side Diff: media/filters/audio_renderer_impl.h

Issue 177333003: Add support for midstream audio configuration changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ABS
Patch Set: Created 6 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Audio rendering unit utilizing an AudioRendererSink to output data. 5 // Audio rendering unit utilizing an AudioRendererSink to output data.
6 // 6 //
7 // This class lives inside three threads during it's lifetime, namely: 7 // This class lives inside three threads during it's lifetime, namely:
8 // 1. Render thread 8 // 1. Render thread
9 // Where the object is created. 9 // Where the object is created.
10 // 2. Media thread (provided via constructor) 10 // 2. Media thread (provided via constructor)
(...skipping 20 matching lines...) Expand all
31 #include "media/filters/audio_renderer_algorithm.h" 31 #include "media/filters/audio_renderer_algorithm.h"
32 #include "media/filters/decoder_stream.h" 32 #include "media/filters/decoder_stream.h"
33 33
34 namespace base { 34 namespace base {
35 class SingleThreadTaskRunner; 35 class SingleThreadTaskRunner;
36 } 36 }
37 37
38 namespace media { 38 namespace media {
39 39
40 class AudioBus; 40 class AudioBus;
41 class AudioBufferConverter;
41 class AudioSplicer; 42 class AudioSplicer;
42 class DecryptingDemuxerStream; 43 class DecryptingDemuxerStream;
44 class AudioHardwareConfig;
43 45
44 class MEDIA_EXPORT AudioRendererImpl 46 class MEDIA_EXPORT AudioRendererImpl
45 : public AudioRenderer, 47 : public AudioRenderer,
46 NON_EXPORTED_BASE(public AudioRendererSink::RenderCallback) { 48 NON_EXPORTED_BASE(public AudioRendererSink::RenderCallback) {
47 public: 49 public:
48 // |task_runner| is the thread on which AudioRendererImpl will execute. 50 // |task_runner| is the thread on which AudioRendererImpl will execute.
49 // 51 //
50 // |sink| is used as the destination for the rendered audio. 52 // |sink| is used as the destination for the rendered audio.
51 // 53 //
52 // |decoders| contains the AudioDecoders to use when initializing. 54 // |decoders| contains the AudioDecoders to use when initializing.
53 // 55 //
54 // |set_decryptor_ready_cb| is fired when the audio decryptor is available 56 // |set_decryptor_ready_cb| is fired when the audio decryptor is available
55 // (only applicable if the stream is encrypted and we have a decryptor). 57 // (only applicable if the stream is encrypted and we have a decryptor).
56 AudioRendererImpl( 58 AudioRendererImpl(
57 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 59 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
58 AudioRendererSink* sink, 60 AudioRendererSink* sink,
59 ScopedVector<AudioDecoder> decoders, 61 ScopedVector<AudioDecoder> decoders,
60 const SetDecryptorReadyCB& set_decryptor_ready_cb); 62 const SetDecryptorReadyCB& set_decryptor_ready_cb,
63 const AudioHardwareConfig& hardware_params);
61 virtual ~AudioRendererImpl(); 64 virtual ~AudioRendererImpl();
62 65
63 // AudioRenderer implementation. 66 // AudioRenderer implementation.
64 virtual void Initialize(DemuxerStream* stream, 67 virtual void Initialize(DemuxerStream* stream,
65 const PipelineStatusCB& init_cb, 68 const PipelineStatusCB& init_cb,
66 const StatisticsCB& statistics_cb, 69 const StatisticsCB& statistics_cb,
67 const base::Closure& underflow_cb, 70 const base::Closure& underflow_cb,
68 const TimeCB& time_cb, 71 const TimeCB& time_cb,
69 const base::Closure& ended_cb, 72 const base::Closure& ended_cb,
70 const base::Closure& disabled_cb, 73 const base::Closure& disabled_cb,
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // Calls |decoder_|.Reset() and arranges for ResetDecoderDone() to get 178 // Calls |decoder_|.Reset() and arranges for ResetDecoderDone() to get
176 // called when the reset completes. 179 // called when the reset completes.
177 void ResetDecoder(); 180 void ResetDecoder();
178 181
179 // Called when the |decoder_|.Reset() has completed. 182 // Called when the |decoder_|.Reset() has completed.
180 void ResetDecoderDone(); 183 void ResetDecoderDone();
181 184
182 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 185 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
183 186
184 scoped_ptr<AudioSplicer> splicer_; 187 scoped_ptr<AudioSplicer> splicer_;
188 scoped_ptr<AudioBufferConverter> buffer_converter_;
185 189
186 // The sink (destination) for rendered audio. |sink_| must only be accessed 190 // The sink (destination) for rendered audio. |sink_| must only be accessed
187 // on |task_runner_|. |sink_| must never be called under |lock_| or else we 191 // on |task_runner_|. |sink_| must never be called under |lock_| or else we
188 // may deadlock between |task_runner_| and the audio callback thread. 192 // may deadlock between |task_runner_| and the audio callback thread.
189 scoped_refptr<media::AudioRendererSink> sink_; 193 scoped_refptr<media::AudioRendererSink> sink_;
190 194
191 AudioBufferStream audio_buffer_stream_; 195 AudioBufferStream audio_buffer_stream_;
192 196
193 // AudioParameters constructed during Initialize(). 197 // Interface to the hardware audio params.
198 const AudioHardwareConfig& hardware_config_;
199
200 // Cached copy of hardware params from |hardware_config_|.
194 AudioParameters audio_parameters_; 201 AudioParameters audio_parameters_;
195 202
196 // Callbacks provided during Initialize(). 203 // Callbacks provided during Initialize().
197 PipelineStatusCB init_cb_; 204 PipelineStatusCB init_cb_;
198 base::Closure underflow_cb_; 205 base::Closure underflow_cb_;
199 TimeCB time_cb_; 206 TimeCB time_cb_;
200 base::Closure ended_cb_; 207 base::Closure ended_cb_;
201 base::Closure disabled_cb_; 208 base::Closure disabled_cb_;
202 PipelineStatusCB error_cb_; 209 PipelineStatusCB error_cb_;
203 210
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 271
265 // NOTE: Weak pointers must be invalidated before all other member variables. 272 // NOTE: Weak pointers must be invalidated before all other member variables.
266 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; 273 base::WeakPtrFactory<AudioRendererImpl> weak_factory_;
267 274
268 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); 275 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl);
269 }; 276 };
270 277
271 } // namespace media 278 } // namespace media
272 279
273 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ 280 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698