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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 protected: | 66 protected: |
67 virtual ~AudioRendererImpl(); | 67 virtual ~AudioRendererImpl(); |
68 | 68 |
69 private: | 69 private: |
70 friend class AudioRendererImplTest; | 70 friend class AudioRendererImplTest; |
71 FRIEND_TEST_ALL_PREFIXES(AudioRendererImplTest, EndOfStream); | 71 FRIEND_TEST_ALL_PREFIXES(AudioRendererImplTest, EndOfStream); |
72 FRIEND_TEST_ALL_PREFIXES(AudioRendererImplTest, Underflow_EndOfStream); | 72 FRIEND_TEST_ALL_PREFIXES(AudioRendererImplTest, Underflow_EndOfStream); |
73 | 73 |
74 // Callback from the audio decoder delivering decoded audio samples. | 74 // Callback from the audio decoder delivering decoded audio samples. |
75 void DecodedAudioReady(scoped_refptr<Buffer> buffer); | 75 void DecodedAudioReady(AudioDecoder::Status status, |
| 76 const scoped_refptr<Buffer>& buffer); |
| 77 |
| 78 // Helper functions for AudioDecoder::Status values passed to |
| 79 // DecodedAudioReady(). |
| 80 void HandleDecodeError(); |
| 81 void HandleAbortedRead(); |
76 | 82 |
77 // 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_|. |
78 // 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 |
79 // 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 |
80 // |requested_frames|. | 86 // |requested_frames|. |
81 // | 87 // |
82 // If this method returns fewer frames than |requested_frames|, it could | 88 // If this method returns fewer frames than |requested_frames|, it could |
83 // 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 |
84 // enough. In such scenarios, the callee should zero out unused portions | 90 // enough. In such scenarios, the callee should zero out unused portions |
85 // of their buffer to playback silence. | 91 // of their buffer to playback silence. |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 bool underflow_disabled_; | 213 bool underflow_disabled_; |
208 | 214 |
209 AudioDecoder::ReadCB read_cb_; | 215 AudioDecoder::ReadCB read_cb_; |
210 | 216 |
211 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); | 217 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); |
212 }; | 218 }; |
213 | 219 |
214 } // namespace media | 220 } // namespace media |
215 | 221 |
216 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ | 222 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ |
OLD | NEW |