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