| 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 // This object is created on the render thread. | 9 // This object is created on the render thread. |
| 10 // 2. Pipeline thread | 10 // 2. Pipeline thread |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 base::Closure underflow_cb_; | 190 base::Closure underflow_cb_; |
| 191 TimeCB time_cb_; | 191 TimeCB time_cb_; |
| 192 base::Closure ended_cb_; | 192 base::Closure ended_cb_; |
| 193 base::Closure disabled_cb_; | 193 base::Closure disabled_cb_; |
| 194 PipelineStatusCB error_cb_; | 194 PipelineStatusCB error_cb_; |
| 195 | 195 |
| 196 base::TimeDelta preroll_timestamp_; | 196 base::TimeDelta preroll_timestamp_; |
| 197 | 197 |
| 198 uint32 bytes_per_frame_; | 198 uint32 bytes_per_frame_; |
| 199 | 199 |
| 200 // Used to calculate audio delay given bytes. | |
| 201 uint32 bytes_per_second_; | |
| 202 | |
| 203 // A flag that indicates this filter is called to stop. | 200 // A flag that indicates this filter is called to stop. |
| 204 bool stopped_; | 201 bool stopped_; |
| 205 | 202 |
| 206 // The sink (destination) for rendered audio. | 203 // The sink (destination) for rendered audio. |
| 207 scoped_refptr<media::AudioRendererSink> sink_; | 204 scoped_refptr<media::AudioRendererSink> sink_; |
| 208 | 205 |
| 209 // Set to true when OnInitialize() is called. | |
| 210 bool is_initialized_; | |
| 211 | |
| 212 // We're supposed to know amount of audio data OS or hardware buffered, but | 206 // We're supposed to know amount of audio data OS or hardware buffered, but |
| 213 // that is not always so -- on my Linux box | 207 // that is not always so -- on my Linux box |
| 214 // AudioBuffersState::hardware_delay_bytes never reaches 0. | 208 // AudioBuffersState::hardware_delay_bytes never reaches 0. |
| 215 // | 209 // |
| 216 // As a result we cannot use it to find when stream ends. If we just ignore | 210 // As a result we cannot use it to find when stream ends. If we just ignore |
| 217 // buffered data we will notify host that stream ended before it is actually | 211 // buffered data we will notify host that stream ended before it is actually |
| 218 // did so, I've seen it done ~140ms too early when playing ~150ms file. | 212 // did so, I've seen it done ~140ms too early when playing ~150ms file. |
| 219 // | 213 // |
| 220 // Instead of trying to invent OS-specific solution for each and every OS we | 214 // Instead of trying to invent OS-specific solution for each and every OS we |
| 221 // are supporting, use simple workaround: every time we fill the buffer we | 215 // are supporting, use simple workaround: every time we fill the buffer we |
| (...skipping 10 matching lines...) Expand all Loading... |
| 232 // True if the renderer receives a buffer with kAborted status during preroll, | 226 // True if the renderer receives a buffer with kAborted status during preroll, |
| 233 // false otherwise. This flag is cleared on the next Preroll() call. | 227 // false otherwise. This flag is cleared on the next Preroll() call. |
| 234 bool preroll_aborted_; | 228 bool preroll_aborted_; |
| 235 | 229 |
| 236 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); | 230 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); |
| 237 }; | 231 }; |
| 238 | 232 |
| 239 } // namespace media | 233 } // namespace media |
| 240 | 234 |
| 241 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ | 235 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ |
| OLD | NEW |