OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_PUSH_FIFO_H_ | 5 #ifndef MEDIA_BASE_AUDIO_PUSH_FIFO_H_ |
6 #define MEDIA_BASE_AUDIO_PUSH_FIFO_H_ | 6 #define MEDIA_BASE_AUDIO_PUSH_FIFO_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/callback.h" | 10 #include "base/callback.h" |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "media/base/audio_bus.h" | 12 #include "media/base/audio_bus.h" |
12 #include "media/base/media_export.h" | 13 #include "media/base/media_export.h" |
13 | 14 |
14 namespace media { | 15 namespace media { |
15 | 16 |
16 // Yet another FIFO for audio data that re-buffers audio to a desired buffer | 17 // Yet another FIFO for audio data that re-buffers audio to a desired buffer |
17 // size. Unlike AudioFifo and AudioBlockFifo, this FIFO cannot overflow: The | 18 // size. Unlike AudioFifo and AudioBlockFifo, this FIFO cannot overflow: The |
18 // client is required to provide a callback that is called synchronously during | 19 // client is required to provide a callback that is called synchronously during |
19 // a push whenever enough data becomes available. This implementation | 20 // a push whenever enough data becomes available. This implementation |
20 // eliminates redundant memory copies when the input buffer size always matches | 21 // eliminates redundant memory copies when the input buffer size always matches |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // frames plus padded zero samples. If there are no frames currently | 56 // frames plus padded zero samples. If there are no frames currently |
56 // enqueued, OutputCallback is not run. | 57 // enqueued, OutputCallback is not run. |
57 void Flush(); | 58 void Flush(); |
58 | 59 |
59 private: | 60 private: |
60 const OutputCallback callback_; | 61 const OutputCallback callback_; |
61 | 62 |
62 int frames_per_buffer_; | 63 int frames_per_buffer_; |
63 | 64 |
64 // Queue of frames pending for delivery. | 65 // Queue of frames pending for delivery. |
65 scoped_ptr<AudioBus> audio_queue_; | 66 std::unique_ptr<AudioBus> audio_queue_; |
66 int queued_frames_; | 67 int queued_frames_; |
67 | 68 |
68 DISALLOW_COPY_AND_ASSIGN(AudioPushFifo); | 69 DISALLOW_COPY_AND_ASSIGN(AudioPushFifo); |
69 }; | 70 }; |
70 | 71 |
71 } // namespace media | 72 } // namespace media |
72 | 73 |
73 #endif // MEDIA_BASE_AUDIO_PUSH_FIFO_H_ | 74 #endif // MEDIA_BASE_AUDIO_PUSH_FIFO_H_ |
OLD | NEW |