OLD | NEW |
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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // completed. | 176 // completed. |
177 void DoFlush_Locked(); | 177 void DoFlush_Locked(); |
178 | 178 |
179 // Calls |decoder_|.Reset() and arranges for ResetDecoderDone() to get | 179 // Calls |decoder_|.Reset() and arranges for ResetDecoderDone() to get |
180 // called when the reset completes. | 180 // called when the reset completes. |
181 void ResetDecoder(); | 181 void ResetDecoder(); |
182 | 182 |
183 // Called when the |decoder_|.Reset() has completed. | 183 // Called when the |decoder_|.Reset() has completed. |
184 void ResetDecoderDone(); | 184 void ResetDecoderDone(); |
185 | 185 |
186 // Called when the |decoder_|.Stop() has completed. | |
187 void StopDecoderDone(); | |
188 | |
189 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 186 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
190 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; | 187 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; |
191 base::WeakPtr<AudioRendererImpl> weak_this_; | 188 base::WeakPtr<AudioRendererImpl> weak_this_; |
192 | 189 |
193 scoped_ptr<AudioSplicer> splicer_; | 190 scoped_ptr<AudioSplicer> splicer_; |
194 | 191 |
195 // The sink (destination) for rendered audio. |sink_| must only be accessed | 192 // The sink (destination) for rendered audio. |sink_| must only be accessed |
196 // 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 |
197 // may deadlock between |task_runner_| and the audio callback thread. | 194 // may deadlock between |task_runner_| and the audio callback thread. |
198 scoped_refptr<media::AudioRendererSink> sink_; | 195 scoped_refptr<media::AudioRendererSink> sink_; |
199 | 196 |
200 scoped_ptr<AudioDecoderSelector> decoder_selector_; | 197 scoped_ptr<AudioDecoderSelector> decoder_selector_; |
201 | 198 |
202 // These two will be set by AudioDecoderSelector::SelectAudioDecoder(). | 199 // These two will be set by AudioDecoderSelector::SelectAudioDecoder(). |
203 scoped_ptr<AudioDecoder> decoder_; | 200 scoped_ptr<AudioDecoder> decoder_; |
204 scoped_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream_; | 201 scoped_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream_; |
205 | 202 |
206 // AudioParameters constructed during Initialize() based on |decoder_|. | 203 // AudioParameters constructed during Initialize() based on |decoder_|. |
207 AudioParameters audio_parameters_; | 204 AudioParameters audio_parameters_; |
208 | 205 |
209 // Callbacks provided during Initialize(). | 206 // Callbacks provided during Initialize(). |
210 PipelineStatusCB init_cb_; | 207 PipelineStatusCB init_cb_; |
211 StatisticsCB statistics_cb_; | 208 StatisticsCB statistics_cb_; |
212 base::Closure underflow_cb_; | 209 base::Closure underflow_cb_; |
213 TimeCB time_cb_; | 210 TimeCB time_cb_; |
214 base::Closure ended_cb_; | 211 base::Closure ended_cb_; |
215 base::Closure disabled_cb_; | 212 base::Closure disabled_cb_; |
216 PipelineStatusCB error_cb_; | 213 PipelineStatusCB error_cb_; |
217 base::Closure stop_cb_; | |
218 | 214 |
219 // Callback provided to Flush(). | 215 // Callback provided to Flush(). |
220 base::Closure flush_cb_; | 216 base::Closure flush_cb_; |
221 | 217 |
222 // Callback provided to Preroll(). | 218 // Callback provided to Preroll(). |
223 PipelineStatusCB preroll_cb_; | 219 PipelineStatusCB preroll_cb_; |
224 | 220 |
225 // Typically calls base::TimeTicks::Now() but can be overridden by a test. | 221 // Typically calls base::TimeTicks::Now() but can be overridden by a test. |
226 NowCB now_cb_; | 222 NowCB now_cb_; |
227 | 223 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 bool preroll_aborted_; | 272 bool preroll_aborted_; |
277 | 273 |
278 // End variables which must be accessed under |lock_|. ---------------------- | 274 // End variables which must be accessed under |lock_|. ---------------------- |
279 | 275 |
280 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); | 276 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); |
281 }; | 277 }; |
282 | 278 |
283 } // namespace media | 279 } // namespace media |
284 | 280 |
285 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ | 281 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ |
OLD | NEW |