Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(435)

Side by Side Diff: media/base/audio_block_fifo.h

Issue 1714593003: Introduce media::AudioPushFifo and a couple of use cases (and clean-ups). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Win compile issue. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_BLOCK_FIFO_H_ 5 #ifndef MEDIA_BASE_AUDIO_BLOCK_FIFO_H_
6 #define MEDIA_BASE_AUDIO_BLOCK_FIFO_H_ 6 #define MEDIA_BASE_AUDIO_BLOCK_FIFO_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "media/base/audio_bus.h" 10 #include "media/base/audio_bus.h"
11 #include "media/base/media_export.h" 11 #include "media/base/media_export.h"
12 12
13 namespace media { 13 namespace media {
14 14
15 // First-in first-out container for AudioBus elements. 15 // First-in first-out container for AudioBus elements.
16 // The FIFO is composed of blocks of AudioBus elements, it accepts interleaved 16 // The FIFO is composed of blocks of AudioBus elements, it accepts interleaved
17 // data as input and will deinterleave it into the FIFO, and it only allows 17 // data as input and will deinterleave it into the FIFO, and it only allows
18 // consuming a whole block of AudioBus element. 18 // consuming a whole block of AudioBus element.
19 // This class is thread-unsafe. 19 // This class is thread-unsafe.
20 //
DaleCurtis 2016/02/20 00:07:22 Do you plan to port and remove existing instances?
miu 2016/02/23 04:27:41 I don't have the available cycles, myself. I've r
21 // NOTE: Consider using the more-efficient and easier-to-use AudioRechunker
22 // instead of this FIFO implementation.
20 class MEDIA_EXPORT AudioBlockFifo { 23 class MEDIA_EXPORT AudioBlockFifo {
21 public: 24 public:
22 // Creates a new AudioBlockFifo and allocates |blocks| memory, each block 25 // Creates a new AudioBlockFifo and allocates |blocks| memory, each block
23 // of memory can store |channels| of length |frames| data. 26 // of memory can store |channels| of length |frames| data.
24 AudioBlockFifo(int channels, int frames, int blocks); 27 AudioBlockFifo(int channels, int frames, int blocks);
25 virtual ~AudioBlockFifo(); 28 virtual ~AudioBlockFifo();
26 29
27 // Pushes interleaved audio data from |source| to the FIFO. 30 // Pushes interleaved audio data from |source| to the FIFO.
28 // The method will deinterleave the data into a audio bus. 31 // The method will deinterleave the data into a audio bus.
29 // Push() will crash if the allocated space is insufficient. 32 // Push() will crash if the allocated space is insufficient.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 74
72 // Current write position in the current written block. 75 // Current write position in the current written block.
73 int write_pos_; 76 int write_pos_;
74 77
75 DISALLOW_COPY_AND_ASSIGN(AudioBlockFifo); 78 DISALLOW_COPY_AND_ASSIGN(AudioBlockFifo);
76 }; 79 };
77 80
78 } // namespace media 81 } // namespace media
79 82
80 #endif // MEDIA_BASE_AUDIO_BLOCK_FIFO_H_ 83 #endif // MEDIA_BASE_AUDIO_BLOCK_FIFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698