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

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

Issue 1955843002: Move Renderer permanent callbacks into RendererClient interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments Created 4 years, 7 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/mojo/services/mojo_renderer_service.cc ('k') | media/renderers/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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 void StopTicking() override; 73 void StopTicking() override;
74 void SetPlaybackRate(double rate) override; 74 void SetPlaybackRate(double rate) override;
75 void SetMediaTime(base::TimeDelta time) override; 75 void SetMediaTime(base::TimeDelta time) override;
76 base::TimeDelta CurrentMediaTime() override; 76 base::TimeDelta CurrentMediaTime() override;
77 bool GetWallClockTimes( 77 bool GetWallClockTimes(
78 const std::vector<base::TimeDelta>& media_timestamps, 78 const std::vector<base::TimeDelta>& media_timestamps,
79 std::vector<base::TimeTicks>* wall_clock_times) override; 79 std::vector<base::TimeTicks>* wall_clock_times) override;
80 80
81 // AudioRenderer implementation. 81 // AudioRenderer implementation.
82 void Initialize(DemuxerStream* stream, 82 void Initialize(DemuxerStream* stream,
83 const PipelineStatusCB& init_cb,
84 CdmContext* cdm_context, 83 CdmContext* cdm_context,
85 const StatisticsCB& statistics_cb, 84 RendererClient* client,
86 const BufferingStateCB& buffering_state_cb, 85 const PipelineStatusCB& init_cb) override;
87 const base::Closure& ended_cb,
88 const PipelineStatusCB& error_cb,
89 const base::Closure& waiting_for_decryption_key_cb) override;
90 TimeSource* GetTimeSource() override; 86 TimeSource* GetTimeSource() override;
91 void Flush(const base::Closure& callback) override; 87 void Flush(const base::Closure& callback) override;
92 void StartPlaying() override; 88 void StartPlaying() override;
93 void SetVolume(float volume) override; 89 void SetVolume(float volume) override;
94 90
95 private: 91 private:
96 friend class AudioRendererImplTest; 92 friend class AudioRendererImplTest;
97 93
98 // Important detail: being in kPlaying doesn't imply that audio is being 94 // Important detail: being in kPlaying doesn't imply that audio is being
99 // rendered. Rather, it means that the renderer is ready to go. The actual 95 // rendered. Rather, it means that the renderer is ready to go. The actual
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 void ChangeState_Locked(State new_state); 165 void ChangeState_Locked(State new_state);
170 166
171 // Returns true if the data in the buffer is all before |start_timestamp_|. 167 // Returns true if the data in the buffer is all before |start_timestamp_|.
172 // This can only return true while in the kPlaying state. 168 // This can only return true while in the kPlaying state.
173 bool IsBeforeStartTime(const scoped_refptr<AudioBuffer>& buffer); 169 bool IsBeforeStartTime(const scoped_refptr<AudioBuffer>& buffer);
174 170
175 // Called upon AudioBufferStream initialization, or failure thereof (indicated 171 // Called upon AudioBufferStream initialization, or failure thereof (indicated
176 // by the value of |success|). 172 // by the value of |success|).
177 void OnAudioBufferStreamInitialized(bool succes); 173 void OnAudioBufferStreamInitialized(bool succes);
178 174
175 // Callback functions to be called on |client_|.
176 void OnPlaybackError(PipelineStatus error);
177 void OnPlaybackEnded();
178 void OnStatisticsUpdate(const PipelineStatistics& stats);
179 void OnBufferingStateChange(BufferingState state);
180 void OnWaitingForDecryptionKey();
181
179 // Used to initiate the flush operation once all pending reads have 182 // Used to initiate the flush operation once all pending reads have
180 // completed. 183 // completed.
181 void DoFlush_Locked(); 184 void DoFlush_Locked();
182 185
183 // Called when the |decoder_|.Reset() has completed. 186 // Called when the |decoder_|.Reset() has completed.
184 void ResetDecoderDone(); 187 void ResetDecoderDone();
185 188
186 // Called by the AudioBufferStream when a splice buffer is demuxed. 189 // Called by the AudioBufferStream when a splice buffer is demuxed.
187 void OnNewSpliceBuffer(base::TimeDelta); 190 void OnNewSpliceBuffer(base::TimeDelta);
188 191
(...skipping 19 matching lines...) Expand all
208 std::unique_ptr<AudioBufferStream> audio_buffer_stream_; 211 std::unique_ptr<AudioBufferStream> audio_buffer_stream_;
209 212
210 // Interface to the hardware audio params. 213 // Interface to the hardware audio params.
211 const AudioHardwareConfig& hardware_config_; 214 const AudioHardwareConfig& hardware_config_;
212 215
213 scoped_refptr<MediaLog> media_log_; 216 scoped_refptr<MediaLog> media_log_;
214 217
215 // Cached copy of hardware params from |hardware_config_|. 218 // Cached copy of hardware params from |hardware_config_|.
216 AudioParameters audio_parameters_; 219 AudioParameters audio_parameters_;
217 220
218 // Callbacks provided during Initialize(). 221 RendererClient* client_;
222
223 // Callback provided during Initialize().
219 PipelineStatusCB init_cb_; 224 PipelineStatusCB init_cb_;
220 BufferingStateCB buffering_state_cb_;
221 base::Closure ended_cb_;
222 PipelineStatusCB error_cb_;
223 StatisticsCB statistics_cb_;
224 225
225 // Callback provided to Flush(). 226 // Callback provided to Flush().
226 base::Closure flush_cb_; 227 base::Closure flush_cb_;
227 228
228 // Overridable tick clock for testing. 229 // Overridable tick clock for testing.
229 std::unique_ptr<base::TickClock> tick_clock_; 230 std::unique_ptr<base::TickClock> tick_clock_;
230 231
231 // Memory usage of |algorithm_| recorded during the last 232 // Memory usage of |algorithm_| recorded during the last
232 // HandleSplicerBuffer_Locked() call. 233 // HandleSplicerBuffer_Locked() call.
233 int64_t last_audio_memory_usage_; 234 int64_t last_audio_memory_usage_;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 293
293 // NOTE: Weak pointers must be invalidated before all other member variables. 294 // NOTE: Weak pointers must be invalidated before all other member variables.
294 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; 295 base::WeakPtrFactory<AudioRendererImpl> weak_factory_;
295 296
296 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); 297 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl);
297 }; 298 };
298 299
299 } // namespace media 300 } // namespace media
300 301
301 #endif // MEDIA_RENDERERS_AUDIO_RENDERER_IMPL_H_ 302 #endif // MEDIA_RENDERERS_AUDIO_RENDERER_IMPL_H_
OLDNEW
« no previous file with comments | « media/mojo/services/mojo_renderer_service.cc ('k') | media/renderers/audio_renderer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698