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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // | 57 // |
58 // |decoders| contains the AudioDecoders to use when initializing. | 58 // |decoders| contains the AudioDecoders to use when initializing. |
59 // | 59 // |
60 // |set_decryptor_ready_cb| is fired when the audio decryptor is available | 60 // |set_decryptor_ready_cb| is fired when the audio decryptor is available |
61 // (only applicable if the stream is encrypted and we have a decryptor). | 61 // (only applicable if the stream is encrypted and we have a decryptor). |
62 AudioRendererImpl( | 62 AudioRendererImpl( |
63 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 63 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
64 AudioRendererSink* sink, | 64 AudioRendererSink* sink, |
65 ScopedVector<AudioDecoder> decoders, | 65 ScopedVector<AudioDecoder> decoders, |
66 const SetDecryptorReadyCB& set_decryptor_ready_cb, | 66 const SetDecryptorReadyCB& set_decryptor_ready_cb, |
67 AudioHardwareConfig* hardware_params); | 67 const AudioHardwareConfig& hardware_params); |
68 virtual ~AudioRendererImpl(); | 68 virtual ~AudioRendererImpl(); |
69 | 69 |
70 // TimeSource implementation. | 70 // TimeSource implementation. |
71 virtual void StartTicking() OVERRIDE; | 71 virtual void StartTicking() OVERRIDE; |
72 virtual void StopTicking() OVERRIDE; | 72 virtual void StopTicking() OVERRIDE; |
73 virtual void SetPlaybackRate(float rate) OVERRIDE; | 73 virtual void SetPlaybackRate(float rate) OVERRIDE; |
74 virtual void SetMediaTime(base::TimeDelta time) OVERRIDE; | 74 virtual void SetMediaTime(base::TimeDelta time) OVERRIDE; |
75 virtual base::TimeDelta CurrentMediaTime() OVERRIDE; | 75 virtual base::TimeDelta CurrentMediaTime() OVERRIDE; |
76 | 76 |
77 // AudioRenderer implementation. | 77 // AudioRenderer implementation. |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 bool expecting_config_changes_; | 199 bool expecting_config_changes_; |
200 | 200 |
201 // The sink (destination) for rendered audio. |sink_| must only be accessed | 201 // The sink (destination) for rendered audio. |sink_| must only be accessed |
202 // on |task_runner_|. |sink_| must never be called under |lock_| or else we | 202 // on |task_runner_|. |sink_| must never be called under |lock_| or else we |
203 // may deadlock between |task_runner_| and the audio callback thread. | 203 // may deadlock between |task_runner_| and the audio callback thread. |
204 scoped_refptr<media::AudioRendererSink> sink_; | 204 scoped_refptr<media::AudioRendererSink> sink_; |
205 | 205 |
206 scoped_ptr<AudioBufferStream> audio_buffer_stream_; | 206 scoped_ptr<AudioBufferStream> audio_buffer_stream_; |
207 | 207 |
208 // Interface to the hardware audio params. | 208 // Interface to the hardware audio params. |
209 const AudioHardwareConfig* const hardware_config_; | 209 const AudioHardwareConfig& hardware_config_; |
210 | 210 |
211 // Cached copy of hardware params from |hardware_config_|. | 211 // Cached copy of hardware params from |hardware_config_|. |
212 AudioParameters audio_parameters_; | 212 AudioParameters audio_parameters_; |
213 | 213 |
214 // Callbacks provided during Initialize(). | 214 // Callbacks provided during Initialize(). |
215 PipelineStatusCB init_cb_; | 215 PipelineStatusCB init_cb_; |
216 TimeCB time_cb_; | 216 TimeCB time_cb_; |
217 BufferingStateCB buffering_state_cb_; | 217 BufferingStateCB buffering_state_cb_; |
218 base::Closure ended_cb_; | 218 base::Closure ended_cb_; |
219 PipelineStatusCB error_cb_; | 219 PipelineStatusCB error_cb_; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 255 |
256 // NOTE: Weak pointers must be invalidated before all other member variables. | 256 // NOTE: Weak pointers must be invalidated before all other member variables. |
257 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; | 257 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; |
258 | 258 |
259 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); | 259 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); |
260 }; | 260 }; |
261 | 261 |
262 } // namespace media | 262 } // namespace media |
263 | 263 |
264 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ | 264 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ |
OLD | NEW |