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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 void DoFlush_Locked(); | 173 void DoFlush_Locked(); |
174 | 174 |
175 // Calls |decoder_|.Reset() and arranges for ResetDecoderDone() to get | 175 // Calls |decoder_|.Reset() and arranges for ResetDecoderDone() to get |
176 // called when the reset completes. | 176 // called when the reset completes. |
177 void ResetDecoder(); | 177 void ResetDecoder(); |
178 | 178 |
179 // Called when the |decoder_|.Reset() has completed. | 179 // Called when the |decoder_|.Reset() has completed. |
180 void ResetDecoderDone(); | 180 void ResetDecoderDone(); |
181 | 181 |
182 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 182 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
183 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; | |
184 base::WeakPtr<AudioRendererImpl> weak_this_; | |
185 | 183 |
186 scoped_ptr<AudioSplicer> splicer_; | 184 scoped_ptr<AudioSplicer> splicer_; |
187 | 185 |
188 // The sink (destination) for rendered audio. |sink_| must only be accessed | 186 // 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 | 187 // on |task_runner_|. |sink_| must never be called under |lock_| or else we |
190 // may deadlock between |task_runner_| and the audio callback thread. | 188 // may deadlock between |task_runner_| and the audio callback thread. |
191 scoped_refptr<media::AudioRendererSink> sink_; | 189 scoped_refptr<media::AudioRendererSink> sink_; |
192 | 190 |
193 AudioBufferStream audio_buffer_stream_; | 191 AudioBufferStream audio_buffer_stream_; |
194 | 192 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 size_t total_frames_filled_; | 255 size_t total_frames_filled_; |
258 | 256 |
259 bool underflow_disabled_; | 257 bool underflow_disabled_; |
260 | 258 |
261 // True if the renderer receives a buffer with kAborted status during preroll, | 259 // True if the renderer receives a buffer with kAborted status during preroll, |
262 // false otherwise. This flag is cleared on the next Preroll() call. | 260 // false otherwise. This flag is cleared on the next Preroll() call. |
263 bool preroll_aborted_; | 261 bool preroll_aborted_; |
264 | 262 |
265 // End variables which must be accessed under |lock_|. ---------------------- | 263 // End variables which must be accessed under |lock_|. ---------------------- |
266 | 264 |
| 265 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 266 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; |
| 267 |
267 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); | 268 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); |
268 }; | 269 }; |
269 | 270 |
270 } // namespace media | 271 } // namespace media |
271 | 272 |
272 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ | 273 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ |
OLD | NEW |