Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: media/filters/audio_renderer_impl.h

Issue 534073002: Switch to using media::TimeSource inside media::RendererImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bad rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/base/wall_clock_time_source.cc ('k') | media/filters/audio_renderer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 const AudioHardwareConfig& hardware_params, 68 const AudioHardwareConfig& hardware_params,
69 const scoped_refptr<MediaLog>& media_log); 69 const scoped_refptr<MediaLog>& media_log);
70 virtual ~AudioRendererImpl(); 70 virtual ~AudioRendererImpl();
71 71
72 // TimeSource implementation. 72 // TimeSource implementation.
73 virtual void StartTicking() OVERRIDE; 73 virtual void StartTicking() OVERRIDE;
74 virtual void StopTicking() OVERRIDE; 74 virtual void StopTicking() OVERRIDE;
75 virtual void SetPlaybackRate(float rate) OVERRIDE; 75 virtual void SetPlaybackRate(float rate) OVERRIDE;
76 virtual void SetMediaTime(base::TimeDelta time) OVERRIDE; 76 virtual void SetMediaTime(base::TimeDelta time) OVERRIDE;
77 virtual base::TimeDelta CurrentMediaTime() OVERRIDE; 77 virtual base::TimeDelta CurrentMediaTime() OVERRIDE;
78 virtual base::TimeDelta CurrentMediaTimeForSyncingVideo() OVERRIDE;
78 79
79 // AudioRenderer implementation. 80 // AudioRenderer implementation.
80 virtual void Initialize(DemuxerStream* stream, 81 virtual void Initialize(DemuxerStream* stream,
81 const PipelineStatusCB& init_cb, 82 const PipelineStatusCB& init_cb,
82 const StatisticsCB& statistics_cb, 83 const StatisticsCB& statistics_cb,
83 const TimeCB& time_cb,
84 const BufferingStateCB& buffering_state_cb, 84 const BufferingStateCB& buffering_state_cb,
85 const base::Closure& ended_cb, 85 const base::Closure& ended_cb,
86 const PipelineStatusCB& error_cb) OVERRIDE; 86 const PipelineStatusCB& error_cb) OVERRIDE;
87 virtual TimeSource* GetTimeSource() OVERRIDE; 87 virtual TimeSource* GetTimeSource() OVERRIDE;
88 virtual void Flush(const base::Closure& callback) OVERRIDE; 88 virtual void Flush(const base::Closure& callback) OVERRIDE;
89 virtual void StartPlaying() OVERRIDE; 89 virtual void StartPlaying() OVERRIDE;
90 virtual void SetVolume(float volume) OVERRIDE; 90 virtual void SetVolume(float volume) OVERRIDE;
91 91
92 private: 92 private:
93 friend class AudioRendererImplTest; 93 friend class AudioRendererImplTest;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 scoped_ptr<AudioBufferStream> audio_buffer_stream_; 208 scoped_ptr<AudioBufferStream> audio_buffer_stream_;
209 209
210 // Interface to the hardware audio params. 210 // Interface to the hardware audio params.
211 const AudioHardwareConfig& hardware_config_; 211 const AudioHardwareConfig& hardware_config_;
212 212
213 // Cached copy of hardware params from |hardware_config_|. 213 // Cached copy of hardware params from |hardware_config_|.
214 AudioParameters audio_parameters_; 214 AudioParameters audio_parameters_;
215 215
216 // Callbacks provided during Initialize(). 216 // Callbacks provided during Initialize().
217 PipelineStatusCB init_cb_; 217 PipelineStatusCB init_cb_;
218 TimeCB time_cb_;
219 BufferingStateCB buffering_state_cb_; 218 BufferingStateCB buffering_state_cb_;
220 base::Closure ended_cb_; 219 base::Closure ended_cb_;
221 PipelineStatusCB error_cb_; 220 PipelineStatusCB error_cb_;
222 221
223 // Callback provided to Flush(). 222 // Callback provided to Flush().
224 base::Closure flush_cb_; 223 base::Closure flush_cb_;
225 224
226 // After Initialize() has completed, all variables below must be accessed 225 // After Initialize() has completed, all variables below must be accessed
227 // under |lock_|. ------------------------------------------------------------ 226 // under |lock_|. ------------------------------------------------------------
228 base::Lock lock_; 227 base::Lock lock_;
(...skipping 14 matching lines...) Expand all
243 242
244 // Keep track of our outstanding read to |decoder_|. 243 // Keep track of our outstanding read to |decoder_|.
245 bool pending_read_; 244 bool pending_read_;
246 245
247 // Keeps track of whether we received and rendered the end of stream buffer. 246 // Keeps track of whether we received and rendered the end of stream buffer.
248 bool received_end_of_stream_; 247 bool received_end_of_stream_;
249 bool rendered_end_of_stream_; 248 bool rendered_end_of_stream_;
250 249
251 scoped_ptr<AudioClock> audio_clock_; 250 scoped_ptr<AudioClock> audio_clock_;
252 251
252 // The media timestamp to begin playback at after seeking. Set via
253 // SetMediaTime().
253 base::TimeDelta start_timestamp_; 254 base::TimeDelta start_timestamp_;
255
256 // The media timestamp to signal end of audio playback. Determined during
257 // Render() when writing the final frames of decoded audio data.
254 base::TimeDelta ended_timestamp_; 258 base::TimeDelta ended_timestamp_;
255 base::TimeDelta last_timestamp_update_; 259
260 // Set every Render() and used to provide an interpolated time value to
261 // CurrentMediaTimeForSyncingVideo().
262 base::TimeTicks last_render_ticks_;
256 263
257 // End variables which must be accessed under |lock_|. ---------------------- 264 // End variables which must be accessed under |lock_|. ----------------------
258 265
259 // NOTE: Weak pointers must be invalidated before all other member variables. 266 // NOTE: Weak pointers must be invalidated before all other member variables.
260 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; 267 base::WeakPtrFactory<AudioRendererImpl> weak_factory_;
261 268
262 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); 269 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl);
263 }; 270 };
264 271
265 } // namespace media 272 } // namespace media
266 273
267 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ 274 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_
OLDNEW
« no previous file with comments | « media/base/wall_clock_time_source.cc ('k') | media/filters/audio_renderer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698