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