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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |audio_delay_milliseconds| should be used to indicate when in the | 155 // this case |audio_delay_milliseconds| should be used to indicate when in the |
156 // future should the filled buffer be played. | 156 // future should the filled buffer be played. |
157 int Render(AudioBus* audio_bus, | 157 int Render(AudioBus* audio_bus, |
158 uint32_t audio_delay_milliseconds, | 158 uint32_t frames_delayed, |
159 uint32_t frames_skipped) override; | 159 uint32_t frames_skipped) override; |
160 void OnRenderError() override; | 160 void OnRenderError() override; |
161 | 161 |
162 // 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 |
163 // as there isn't a pending read. | 163 // as there isn't a pending read. |
164 // | 164 // |
165 // Must be called on |task_runner_|. | 165 // Must be called on |task_runner_|. |
166 void AttemptRead(); | 166 void AttemptRead(); |
167 void AttemptRead_Locked(); | 167 void AttemptRead_Locked(); |
168 bool CanRead_Locked(); | 168 bool CanRead_Locked(); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 284 |
285 // NOTE: Weak pointers must be invalidated before all other member variables. | 285 // NOTE: Weak pointers must be invalidated before all other member variables. |
286 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; | 286 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; |
287 | 287 |
288 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); | 288 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); |
289 }; | 289 }; |
290 | 290 |
291 } // namespace media | 291 } // namespace media |
292 | 292 |
293 #endif // MEDIA_RENDERERS_AUDIO_RENDERER_IMPL_H_ | 293 #endif // MEDIA_RENDERERS_AUDIO_RENDERER_IMPL_H_ |
OLD | NEW |