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

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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; 186 base::WeakPtrFactory<AudioRendererImpl> weak_factory_;
184 base::WeakPtr<AudioRendererImpl> weak_this_; 187 base::WeakPtr<AudioRendererImpl> weak_this_;
185 188
186 scoped_ptr<AudioSplicer> splicer_; 189 scoped_ptr<AudioSplicer> splicer_;
190 scoped_ptr<AudioBufferConverter> buffer_converter_;
187 191
188 // The sink (destination) for rendered audio. |sink_| must only be accessed 192 // The sink (destination) for rendered audio. |sink_| must only be accessed
189 // on |task_runner_|. |sink_| must never be called under |lock_| or else we 193 // on |task_runner_|. |sink_| must never be called under |lock_| or else we
190 // may deadlock between |task_runner_| and the audio callback thread. 194 // may deadlock between |task_runner_| and the audio callback thread.
191 scoped_refptr<media::AudioRendererSink> sink_; 195 scoped_refptr<media::AudioRendererSink> sink_;
192 196
193 AudioBufferStream audio_buffer_stream_; 197 AudioBufferStream audio_buffer_stream_;
194 198
195 // AudioParameters constructed during Initialize(). 199 // Interface to the hardware audio params.
200 const AudioHardwareConfig& hardware_config_;
201
202 // Cached copy of hardware params from |hardware_config_|.
196 AudioParameters audio_parameters_; 203 AudioParameters audio_parameters_;
197 204
198 // Callbacks provided during Initialize(). 205 // Callbacks provided during Initialize().
199 PipelineStatusCB init_cb_; 206 PipelineStatusCB init_cb_;
200 base::Closure underflow_cb_; 207 base::Closure underflow_cb_;
201 TimeCB time_cb_; 208 TimeCB time_cb_;
202 base::Closure ended_cb_; 209 base::Closure ended_cb_;
203 base::Closure disabled_cb_; 210 base::Closure disabled_cb_;
204 PipelineStatusCB error_cb_; 211 PipelineStatusCB error_cb_;
205 212
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 bool preroll_aborted_; 270 bool preroll_aborted_;
264 271
265 // End variables which must be accessed under |lock_|. ---------------------- 272 // End variables which must be accessed under |lock_|. ----------------------
266 273
267 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); 274 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl);
268 }; 275 };
269 276
270 } // namespace media 277 } // namespace media
271 278
272 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ 279 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698