| 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 const CreateAudioDecodersCB& create_audio_decoders_cb, | 66 const CreateAudioDecodersCB& create_audio_decoders_cb, |
| 67 const scoped_refptr<MediaLog>& media_log); | 67 MediaLog* media_log); |
| 68 ~AudioRendererImpl() override; | 68 ~AudioRendererImpl() override; |
| 69 | 69 |
| 70 // TimeSource implementation. | 70 // TimeSource implementation. |
| 71 void StartTicking() override; | 71 void StartTicking() override; |
| 72 void StopTicking() override; | 72 void StopTicking() override; |
| 73 void SetPlaybackRate(double rate) override; | 73 void SetPlaybackRate(double rate) override; |
| 74 void SetMediaTime(base::TimeDelta time) override; | 74 void SetMediaTime(base::TimeDelta time) override; |
| 75 base::TimeDelta CurrentMediaTime() override; | 75 base::TimeDelta CurrentMediaTime() override; |
| 76 bool GetWallClockTimes( | 76 bool GetWallClockTimes( |
| 77 const std::vector<base::TimeDelta>& media_timestamps, | 77 const std::vector<base::TimeDelta>& media_timestamps, |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 // Whether or not we expect to handle config changes. | 210 // Whether or not we expect to handle config changes. |
| 211 bool expecting_config_changes_; | 211 bool expecting_config_changes_; |
| 212 | 212 |
| 213 // The sink (destination) for rendered audio. |sink_| must only be accessed | 213 // The sink (destination) for rendered audio. |sink_| must only be accessed |
| 214 // on |task_runner_|. |sink_| must never be called under |lock_| or else we | 214 // on |task_runner_|. |sink_| must never be called under |lock_| or else we |
| 215 // may deadlock between |task_runner_| and the audio callback thread. | 215 // may deadlock between |task_runner_| and the audio callback thread. |
| 216 scoped_refptr<media::AudioRendererSink> sink_; | 216 scoped_refptr<media::AudioRendererSink> sink_; |
| 217 | 217 |
| 218 std::unique_ptr<AudioBufferStream> audio_buffer_stream_; | 218 std::unique_ptr<AudioBufferStream> audio_buffer_stream_; |
| 219 | 219 |
| 220 scoped_refptr<MediaLog> media_log_; | 220 MediaLog* media_log_; |
| 221 | 221 |
| 222 // Cached copy of hardware params from |sink_|. | 222 // Cached copy of hardware params from |sink_|. |
| 223 AudioParameters audio_parameters_; | 223 AudioParameters audio_parameters_; |
| 224 | 224 |
| 225 RendererClient* client_; | 225 RendererClient* client_; |
| 226 | 226 |
| 227 // Callback provided during Initialize(). | 227 // Callback provided during Initialize(). |
| 228 PipelineStatusCB init_cb_; | 228 PipelineStatusCB init_cb_; |
| 229 | 229 |
| 230 // Callback provided to Flush(). | 230 // Callback provided to Flush(). |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 305 |
| 306 // NOTE: Weak pointers must be invalidated before all other member variables. | 306 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 307 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; | 307 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; |
| 308 | 308 |
| 309 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); | 309 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); |
| 310 }; | 310 }; |
| 311 | 311 |
| 312 } // namespace media | 312 } // namespace media |
| 313 | 313 |
| 314 #endif // MEDIA_RENDERERS_AUDIO_RENDERER_IMPL_H_ | 314 #endif // MEDIA_RENDERERS_AUDIO_RENDERER_IMPL_H_ |
| OLD | NEW |