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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 const SetDecryptorReadyCB& set_decryptor_ready_cb, | 66 const SetDecryptorReadyCB& set_decryptor_ready_cb, |
67 const 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 virtual base::TimeDelta ApproximateCurrentMediaTime() OVERRIDE; | |
76 | 77 |
77 // AudioRenderer implementation. | 78 // AudioRenderer implementation. |
78 virtual void Initialize(DemuxerStream* stream, | 79 virtual void Initialize(DemuxerStream* stream, |
79 const PipelineStatusCB& init_cb, | 80 const PipelineStatusCB& init_cb, |
80 const StatisticsCB& statistics_cb, | 81 const StatisticsCB& statistics_cb, |
81 const TimeCB& time_cb, | |
82 const BufferingStateCB& buffering_state_cb, | 82 const BufferingStateCB& buffering_state_cb, |
83 const base::Closure& ended_cb, | 83 const base::Closure& ended_cb, |
84 const PipelineStatusCB& error_cb) OVERRIDE; | 84 const PipelineStatusCB& error_cb) OVERRIDE; |
85 virtual TimeSource* GetTimeSource() OVERRIDE; | 85 virtual TimeSource* GetTimeSource() OVERRIDE; |
86 virtual void Flush(const base::Closure& callback) OVERRIDE; | 86 virtual void Flush(const base::Closure& callback) OVERRIDE; |
87 virtual void StartPlaying() OVERRIDE; | 87 virtual void StartPlaying() OVERRIDE; |
88 virtual void SetVolume(float volume) OVERRIDE; | 88 virtual void SetVolume(float volume) OVERRIDE; |
89 | 89 |
90 private: | 90 private: |
91 friend class AudioRendererImplTest; | 91 friend class AudioRendererImplTest; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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& 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_; | |
217 BufferingStateCB buffering_state_cb_; | 216 BufferingStateCB buffering_state_cb_; |
218 base::Closure ended_cb_; | 217 base::Closure ended_cb_; |
219 PipelineStatusCB error_cb_; | 218 PipelineStatusCB error_cb_; |
220 | 219 |
221 // Callback provided to Flush(). | 220 // Callback provided to Flush(). |
222 base::Closure flush_cb_; | 221 base::Closure flush_cb_; |
223 | 222 |
224 // After Initialize() has completed, all variables below must be accessed | 223 // After Initialize() has completed, all variables below must be accessed |
225 // under |lock_|. ------------------------------------------------------------ | 224 // under |lock_|. ------------------------------------------------------------ |
226 base::Lock lock_; | 225 base::Lock lock_; |
(...skipping 16 matching lines...) Expand all Loading... | |
243 bool pending_read_; | 242 bool pending_read_; |
244 | 243 |
245 // Keeps track of whether we received and rendered the end of stream buffer. | 244 // Keeps track of whether we received and rendered the end of stream buffer. |
246 bool received_end_of_stream_; | 245 bool received_end_of_stream_; |
247 bool rendered_end_of_stream_; | 246 bool rendered_end_of_stream_; |
248 | 247 |
249 scoped_ptr<AudioClock> audio_clock_; | 248 scoped_ptr<AudioClock> audio_clock_; |
250 | 249 |
251 base::TimeDelta start_timestamp_; | 250 base::TimeDelta start_timestamp_; |
252 base::TimeDelta ended_timestamp_; | 251 base::TimeDelta ended_timestamp_; |
253 base::TimeDelta last_timestamp_update_; | 252 base::TimeTicks last_render_ticks_; |
xhwang
2014/09/08 22:56:06
As discussed offline, it would be nicer to add som
scherkus (not reviewing)
2014/09/09 18:17:18
Done.
| |
254 | 253 |
255 // End variables which must be accessed under |lock_|. ---------------------- | 254 // End variables which must be accessed under |lock_|. ---------------------- |
256 | 255 |
257 // NOTE: Weak pointers must be invalidated before all other member variables. | 256 // NOTE: Weak pointers must be invalidated before all other member variables. |
258 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; | 257 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; |
259 | 258 |
260 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); | 259 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); |
261 }; | 260 }; |
262 | 261 |
263 } // namespace media | 262 } // namespace media |
264 | 263 |
265 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ | 264 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ |
OLD | NEW |