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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 // |algorithm_|. Render() also takes care of updating the clock. | 143 // |algorithm_|. Render() also takes care of updating the clock. |
144 // Returns the number of frames copied into |audio_bus|, which may be less | 144 // Returns the number of frames copied into |audio_bus|, which may be less |
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 |
miu
2016/10/23 01:19:16
This part of the comment needs to be updated to re
Mikhail
2016/10/24 19:50:24
Done.
| |
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 |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(AudioBus* audio_bus, | 157 int Render(AudioBus* dest, |
158 uint32_t frames_delayed, | 158 base::TimeDelta delay, |
159 uint32_t frames_skipped) override; | 159 base::TimeTicks delay_timestamp, |
160 uint32_t prior_frames_skipped) 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
297 | 298 |
298 // NOTE: Weak pointers must be invalidated before all other member variables. | 299 // NOTE: Weak pointers must be invalidated before all other member variables. |
299 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; | 300 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; |
300 | 301 |
301 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); | 302 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); |
302 }; | 303 }; |
303 | 304 |
304 } // namespace media | 305 } // namespace media |
305 | 306 |
306 #endif // MEDIA_RENDERERS_AUDIO_RENDERER_IMPL_H_ | 307 #endif // MEDIA_RENDERERS_AUDIO_RENDERER_IMPL_H_ |
OLD | NEW |