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

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

Issue 1538563002: Forward the number of skipped frames by the OS in audio playout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review fix. git cl format. Rebase. Created 5 years 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/cast/test/utility/audio_utility.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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // If this method returns fewer frames than the initial number of frames in 144 // If this method returns fewer frames than the initial number of frames in
145 // |audio_bus|, it could be a sign that the pipeline is stalled or unable to 145 // |audio_bus|, it could be a sign that the pipeline is stalled or unable to
146 // stream the data fast enough. In such scenarios, the callee should zero out 146 // stream the data fast enough. In such scenarios, the callee should zero out
147 // unused portions of their buffer to play back silence. 147 // unused portions of their buffer to play back silence.
148 // 148 //
149 // Render() updates the pipeline's playback timestamp. If Render() is 149 // Render() updates the pipeline's playback timestamp. If Render() is
150 // not called at the same rate as audio samples are played, then the reported 150 // not called at the same rate as audio samples are played, then the reported
151 // timestamp in the pipeline will be ahead of the actual audio playback. In 151 // timestamp in the pipeline will be ahead of the actual audio playback. In
152 // this case |audio_delay_milliseconds| should be used to indicate when in the 152 // this case |audio_delay_milliseconds| should be used to indicate when in the
153 // future should the filled buffer be played. 153 // future should the filled buffer be played.
154 int Render(AudioBus* audio_bus, int audio_delay_milliseconds) override; 154 int Render(AudioBus* audio_bus,
155 uint32_t audio_delay_milliseconds,
156 uint32_t frames_skipped) override;
155 void OnRenderError() override; 157 void OnRenderError() override;
156 158
157 // Helper methods that schedule an asynchronous read from the decoder as long 159 // Helper methods that schedule an asynchronous read from the decoder as long
158 // as there isn't a pending read. 160 // as there isn't a pending read.
159 // 161 //
160 // Must be called on |task_runner_|. 162 // Must be called on |task_runner_|.
161 void AttemptRead(); 163 void AttemptRead();
162 void AttemptRead_Locked(); 164 void AttemptRead_Locked();
163 bool CanRead_Locked(); 165 bool CanRead_Locked();
164 void ChangeState_Locked(State new_state); 166 void ChangeState_Locked(State new_state);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 281
280 // NOTE: Weak pointers must be invalidated before all other member variables. 282 // NOTE: Weak pointers must be invalidated before all other member variables.
281 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; 283 base::WeakPtrFactory<AudioRendererImpl> weak_factory_;
282 284
283 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); 285 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl);
284 }; 286 };
285 287
286 } // namespace media 288 } // namespace media
287 289
288 #endif // MEDIA_RENDERERS_AUDIO_RENDERER_IMPL_H_ 290 #endif // MEDIA_RENDERERS_AUDIO_RENDERER_IMPL_H_
OLDNEW
« no previous file with comments | « media/cast/test/utility/audio_utility.cc ('k') | media/renderers/audio_renderer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698