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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |frames_delayed| should be used to indicate when in the future | 155 // this case |delay| 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(AudioBus* audio_bus, | 157 int Render(base::TimeDelta delay, |
158 uint32_t frames_delayed, | 158 base::TimeTicks delay_timestamp, |
159 uint32_t frames_skipped) override; | 159 int prior_frames_skipped, |
| 160 AudioBus* dest) override; |
160 void OnRenderError() override; | 161 void OnRenderError() override; |
161 | 162 |
162 // Helper methods that schedule an asynchronous read from the decoder as long | 163 // Helper methods that schedule an asynchronous read from the decoder as long |
163 // as there isn't a pending read. | 164 // as there isn't a pending read. |
164 // | 165 // |
165 // Must be called on |task_runner_|. | 166 // Must be called on |task_runner_|. |
166 void AttemptRead(); | 167 void AttemptRead(); |
167 void AttemptRead_Locked(); | 168 void AttemptRead_Locked(); |
168 bool CanRead_Locked(); | 169 bool CanRead_Locked(); |
169 void ChangeState_Locked(State new_state); | 170 void ChangeState_Locked(State new_state); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 | 291 |
291 // NOTE: Weak pointers must be invalidated before all other member variables. | 292 // NOTE: Weak pointers must be invalidated before all other member variables. |
292 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; | 293 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; |
293 | 294 |
294 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); | 295 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); |
295 }; | 296 }; |
296 | 297 |
297 } // namespace media | 298 } // namespace media |
298 | 299 |
299 #endif // MEDIA_RENDERERS_AUDIO_RENDERER_IMPL_H_ | 300 #endif // MEDIA_RENDERERS_AUDIO_RENDERER_IMPL_H_ |
OLD | NEW |