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

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

Issue 2452183003: Revert of Make more media APIs aware of |delay| and |delay_timestamp| (Closed)
Patch Set: Created 4 years, 1 month 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
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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // than or equal to the initial number of frames in |audio_bus| 145 // than or equal to the initial number of frames in |audio_bus|
146 // 146 //
147 // If this method returns fewer frames than the initial number of frames in 147 // If this method returns fewer frames than the initial number of frames in
148 // |audio_bus|, it could be a sign that the pipeline is stalled or unable to 148 // |audio_bus|, it could be a sign that the pipeline is stalled or unable to
149 // stream the data fast enough. In such scenarios, the callee should zero out 149 // stream the data fast enough. In such scenarios, the callee should zero out
150 // unused portions of their buffer to play back silence. 150 // unused portions of their buffer to play back silence.
151 // 151 //
152 // Render() updates the pipeline's playback timestamp. If Render() is 152 // Render() updates the pipeline's playback timestamp. If Render() is
153 // not called at the same rate as audio samples are played, then the reported 153 // not called at the same rate as audio samples are played, then the reported
154 // timestamp in the pipeline will be ahead of the actual audio playback. In 154 // timestamp in the pipeline will be ahead of the actual audio playback. In
155 // this case |delay| should be used to indicate when in the future 155 // this case |frames_delayed| should be used to indicate when in the future
156 // should the filled buffer be played. 156 // should the filled buffer be played.
157 int Render(base::TimeDelta delay, 157 int Render(AudioBus* audio_bus,
158 base::TimeTicks delay_timestamp, 158 uint32_t frames_delayed,
159 int prior_frames_skipped, 159 uint32_t frames_skipped) override;
160 AudioBus* dest) override;
161 void OnRenderError() override; 160 void OnRenderError() override;
162 161
163 // Helper methods that schedule an asynchronous read from the decoder as long 162 // Helper methods that schedule an asynchronous read from the decoder as long
164 // as there isn't a pending read. 163 // as there isn't a pending read.
165 // 164 //
166 // Must be called on |task_runner_|. 165 // Must be called on |task_runner_|.
167 void AttemptRead(); 166 void AttemptRead();
168 void AttemptRead_Locked(); 167 void AttemptRead_Locked();
169 bool CanRead_Locked(); 168 bool CanRead_Locked();
170 void ChangeState_Locked(State new_state); 169 void ChangeState_Locked(State new_state);
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 297
299 // NOTE: Weak pointers must be invalidated before all other member variables. 298 // NOTE: Weak pointers must be invalidated before all other member variables.
300 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; 299 base::WeakPtrFactory<AudioRendererImpl> weak_factory_;
301 300
302 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); 301 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl);
303 }; 302 };
304 303
305 } // namespace media 304 } // namespace media
306 305
307 #endif // MEDIA_RENDERERS_AUDIO_RENDERER_IMPL_H_ 306 #endif // MEDIA_RENDERERS_AUDIO_RENDERER_IMPL_H_
OLDNEW
« no previous file with comments | « media/blink/webaudiosourceprovider_impl_unittest.cc ('k') | media/renderers/audio_renderer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698