| 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 public: | 57 public: |
| 58 // |task_runner| is the thread on which AudioRendererImpl will execute. | 58 // |task_runner| is the thread on which AudioRendererImpl will execute. |
| 59 // | 59 // |
| 60 // |sink| is used as the destination for the rendered audio. | 60 // |sink| is used as the destination for the rendered audio. |
| 61 // | 61 // |
| 62 // |decoders| contains the AudioDecoders to use when initializing. | 62 // |decoders| contains the AudioDecoders to use when initializing. |
| 63 AudioRendererImpl( | 63 AudioRendererImpl( |
| 64 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 64 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 65 AudioRendererSink* sink, | 65 AudioRendererSink* sink, |
| 66 ScopedVector<AudioDecoder> decoders, | 66 ScopedVector<AudioDecoder> decoders, |
| 67 const AudioHardwareConfig& hardware_config, | |
| 68 const scoped_refptr<MediaLog>& media_log); | 67 const scoped_refptr<MediaLog>& media_log); |
| 69 ~AudioRendererImpl() override; | 68 ~AudioRendererImpl() override; |
| 70 | 69 |
| 71 // TimeSource implementation. | 70 // TimeSource implementation. |
| 72 void StartTicking() override; | 71 void StartTicking() override; |
| 73 void StopTicking() override; | 72 void StopTicking() override; |
| 74 void SetPlaybackRate(double rate) override; | 73 void SetPlaybackRate(double rate) override; |
| 75 void SetMediaTime(base::TimeDelta time) override; | 74 void SetMediaTime(base::TimeDelta time) override; |
| 76 base::TimeDelta CurrentMediaTime() override; | 75 base::TimeDelta CurrentMediaTime() override; |
| 77 bool GetWallClockTimes( | 76 bool GetWallClockTimes( |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 // Whether or not we expect to handle config changes. | 202 // Whether or not we expect to handle config changes. |
| 204 bool expecting_config_changes_; | 203 bool expecting_config_changes_; |
| 205 | 204 |
| 206 // The sink (destination) for rendered audio. |sink_| must only be accessed | 205 // The sink (destination) for rendered audio. |sink_| must only be accessed |
| 207 // on |task_runner_|. |sink_| must never be called under |lock_| or else we | 206 // on |task_runner_|. |sink_| must never be called under |lock_| or else we |
| 208 // may deadlock between |task_runner_| and the audio callback thread. | 207 // may deadlock between |task_runner_| and the audio callback thread. |
| 209 scoped_refptr<media::AudioRendererSink> sink_; | 208 scoped_refptr<media::AudioRendererSink> sink_; |
| 210 | 209 |
| 211 std::unique_ptr<AudioBufferStream> audio_buffer_stream_; | 210 std::unique_ptr<AudioBufferStream> audio_buffer_stream_; |
| 212 | 211 |
| 213 // Interface to the hardware audio params. | |
| 214 const AudioHardwareConfig& hardware_config_; | |
| 215 | |
| 216 scoped_refptr<MediaLog> media_log_; | 212 scoped_refptr<MediaLog> media_log_; |
| 217 | 213 |
| 218 // Cached copy of hardware params from |hardware_config_|. | 214 // Cached copy of hardware params from |sink_|. |
| 219 AudioParameters audio_parameters_; | 215 AudioParameters audio_parameters_; |
| 220 | 216 |
| 221 RendererClient* client_; | 217 RendererClient* client_; |
| 222 | 218 |
| 223 // Callback provided during Initialize(). | 219 // Callback provided during Initialize(). |
| 224 PipelineStatusCB init_cb_; | 220 PipelineStatusCB init_cb_; |
| 225 | 221 |
| 226 // Callback provided to Flush(). | 222 // Callback provided to Flush(). |
| 227 base::Closure flush_cb_; | 223 base::Closure flush_cb_; |
| 228 | 224 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 | 289 |
| 294 // NOTE: Weak pointers must be invalidated before all other member variables. | 290 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 295 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; | 291 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; |
| 296 | 292 |
| 297 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); | 293 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); |
| 298 }; | 294 }; |
| 299 | 295 |
| 300 } // namespace media | 296 } // namespace media |
| 301 | 297 |
| 302 #endif // MEDIA_RENDERERS_AUDIO_RENDERER_IMPL_H_ | 298 #endif // MEDIA_RENDERERS_AUDIO_RENDERER_IMPL_H_ |
| OLD | NEW |