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 #ifndef MEDIA_BASE_AUDIO_FIFO_H_ | 5 #ifndef MEDIA_BASE_AUDIO_FIFO_H_ |
6 #define MEDIA_BASE_AUDIO_FIFO_H_ | 6 #define MEDIA_BASE_AUDIO_FIFO_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "media/base/audio_bus.h" | 9 #include "media/base/audio_bus.h" |
10 #include "media/base/media_export.h" | 10 #include "media/base/media_export.h" |
11 | 11 |
12 namespace media { | 12 namespace media { |
13 | 13 |
14 // First-in first-out container for AudioBus elements. | 14 // First-in first-out container for AudioBus elements. |
15 // The maximum number of audio frames in the FIFO is set at construction and | 15 // The maximum number of audio frames in the FIFO is set at construction and |
16 // can not be extended dynamically. The allocated memory is utilized as a | 16 // can not be extended dynamically. The allocated memory is utilized as a |
17 // ring buffer. | 17 // ring buffer. |
18 // This class is thread-unsafe. | 18 // This class is thread-unsafe. |
| 19 // |
| 20 // NOTE: Consider using the more-efficient and easier-to-use AudioRechunker |
| 21 // instead of this FIFO implementation. |
19 class MEDIA_EXPORT AudioFifo { | 22 class MEDIA_EXPORT AudioFifo { |
20 public: | 23 public: |
21 // Creates a new AudioFifo and allocates |channels| of length |frames|. | 24 // Creates a new AudioFifo and allocates |channels| of length |frames|. |
22 AudioFifo(int channels, int frames); | 25 AudioFifo(int channels, int frames); |
23 virtual ~AudioFifo(); | 26 virtual ~AudioFifo(); |
24 | 27 |
25 // Pushes all audio channel data from |source| to the FIFO. | 28 // Pushes all audio channel data from |source| to the FIFO. |
26 // Push() will crash if the allocated space is insufficient. | 29 // Push() will crash if the allocated space is insufficient. |
27 void Push(const AudioBus* source); | 30 void Push(const AudioBus* source); |
28 | 31 |
(...skipping 29 matching lines...) Expand all Loading... |
58 | 61 |
59 // Current write position. | 62 // Current write position. |
60 int write_pos_; | 63 int write_pos_; |
61 | 64 |
62 DISALLOW_COPY_AND_ASSIGN(AudioFifo); | 65 DISALLOW_COPY_AND_ASSIGN(AudioFifo); |
63 }; | 66 }; |
64 | 67 |
65 } // namespace media | 68 } // namespace media |
66 | 69 |
67 #endif // MEDIA_BASE_AUDIO_FIFO_H_ | 70 #endif // MEDIA_BASE_AUDIO_FIFO_H_ |
OLD | NEW |