| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 protected: | 67 protected: |
| 68 virtual ~AudioRendererImpl(); | 68 virtual ~AudioRendererImpl(); |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 friend class AudioRendererImplTest; | 71 friend class AudioRendererImplTest; |
| 72 FRIEND_TEST_ALL_PREFIXES(AudioRendererImplTest, EndOfStream); | 72 FRIEND_TEST_ALL_PREFIXES(AudioRendererImplTest, EndOfStream); |
| 73 FRIEND_TEST_ALL_PREFIXES(AudioRendererImplTest, Underflow_EndOfStream); | 73 FRIEND_TEST_ALL_PREFIXES(AudioRendererImplTest, Underflow_EndOfStream); |
| 74 | 74 |
| 75 // Callback from the audio decoder delivering decoded audio samples. | 75 // Callback from the audio decoder delivering decoded audio samples. |
| 76 void DecodedAudioReady(scoped_refptr<Buffer> buffer); | 76 void DecodedAudioReady(AudioDecoder::Status status, |
| 77 const scoped_refptr<Buffer>& buffer); |
| 78 |
| 79 // Helper functions for AudioDecoder::Status values passed to |
| 80 // DecodedAudioReady(). |
| 81 void HandleAbortedReadOrDecodeError(bool is_decode_error); |
| 77 | 82 |
| 78 // Fills the given buffer with audio data by delegating to its |algorithm_|. | 83 // Fills the given buffer with audio data by delegating to its |algorithm_|. |
| 79 // FillBuffer() also takes care of updating the clock. Returns the number of | 84 // FillBuffer() also takes care of updating the clock. Returns the number of |
| 80 // frames copied into |dest|, which may be less than or equal to | 85 // frames copied into |dest|, which may be less than or equal to |
| 81 // |requested_frames|. | 86 // |requested_frames|. |
| 82 // | 87 // |
| 83 // If this method returns fewer frames than |requested_frames|, it could | 88 // If this method returns fewer frames than |requested_frames|, it could |
| 84 // be a sign that the pipeline is stalled or unable to stream the data fast | 89 // be a sign that the pipeline is stalled or unable to stream the data fast |
| 85 // enough. In such scenarios, the callee should zero out unused portions | 90 // enough. In such scenarios, the callee should zero out unused portions |
| 86 // of their buffer to playback silence. | 91 // of their buffer to playback silence. |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 bool underflow_disabled_; | 215 bool underflow_disabled_; |
| 211 | 216 |
| 212 AudioDecoder::ReadCB read_cb_; | 217 AudioDecoder::ReadCB read_cb_; |
| 213 | 218 |
| 214 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); | 219 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); |
| 215 }; | 220 }; |
| 216 | 221 |
| 217 } // namespace media | 222 } // namespace media |
| 218 | 223 |
| 219 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ | 224 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ |
| OLD | NEW |