| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // than or equal to the initial number of frames in |audio_bus| | 141 // than or equal to the initial number of frames in |audio_bus| |
| 142 // | 142 // |
| 143 // If this method returns fewer frames than the initial number of frames in | 143 // If this method returns fewer frames than the initial number of frames in |
| 144 // |audio_bus|, it could be a sign that the pipeline is stalled or unable to | 144 // |audio_bus|, it could be a sign that the pipeline is stalled or unable to |
| 145 // stream the data fast enough. In such scenarios, the callee should zero out | 145 // stream the data fast enough. In such scenarios, the callee should zero out |
| 146 // unused portions of their buffer to play back silence. | 146 // unused portions of their buffer to play back silence. |
| 147 // | 147 // |
| 148 // Render() updates the pipeline's playback timestamp. If Render() is | 148 // Render() updates the pipeline's playback timestamp. If Render() is |
| 149 // not called at the same rate as audio samples are played, then the reported | 149 // not called at the same rate as audio samples are played, then the reported |
| 150 // timestamp in the pipeline will be ahead of the actual audio playback. In | 150 // timestamp in the pipeline will be ahead of the actual audio playback. In |
| 151 // this case |audio_delay_milliseconds| should be used to indicate when in the | 151 // this case |frames_delayed| should be used to indicate when in the future |
| 152 // future should the filled buffer be played. | 152 // should the filled buffer be played. |
| 153 int Render(AudioBus* audio_bus, | 153 int Render(AudioBus* audio_bus, |
| 154 uint32_t frames_delayed, | 154 uint32_t frames_delayed, |
| 155 uint32_t frames_skipped) override; | 155 uint32_t frames_skipped) override; |
| 156 void OnRenderError() override; | 156 void OnRenderError() override; |
| 157 | 157 |
| 158 // Helper methods that schedule an asynchronous read from the decoder as long | 158 // Helper methods that schedule an asynchronous read from the decoder as long |
| 159 // as there isn't a pending read. | 159 // as there isn't a pending read. |
| 160 // | 160 // |
| 161 // Must be called on |task_runner_|. | 161 // Must be called on |task_runner_|. |
| 162 void AttemptRead(); | 162 void AttemptRead(); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 | 293 |
| 294 // NOTE: Weak pointers must be invalidated before all other member variables. | 294 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 295 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; | 295 base::WeakPtrFactory<AudioRendererImpl> weak_factory_; |
| 296 | 296 |
| 297 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); | 297 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); |
| 298 }; | 298 }; |
| 299 | 299 |
| 300 } // namespace media | 300 } // namespace media |
| 301 | 301 |
| 302 #endif // MEDIA_RENDERERS_AUDIO_RENDERER_IMPL_H_ | 302 #endif // MEDIA_RENDERERS_AUDIO_RENDERER_IMPL_H_ |
| OLD | NEW |