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

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

Issue 396263004: Switch the input code to use AudioBlockFifo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed the comments. Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « media/audio/pulse/pulse_input.cc ('k') | media/base/audio_block_fifo.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.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"
(...skipping 21 matching lines...) Expand all
32 // contains the consumed audio data to avoid copying. 32 // contains the consumed audio data to avoid copying.
33 // Consume() will crash if the FIFO does not contain a block of data. 33 // Consume() will crash if the FIFO does not contain a block of data.
34 const AudioBus* Consume(); 34 const AudioBus* Consume();
35 35
36 // Empties the FIFO without deallocating any memory. 36 // Empties the FIFO without deallocating any memory.
37 void Clear(); 37 void Clear();
38 38
39 // Number of available block of memory ready to be consumed in the FIFO. 39 // Number of available block of memory ready to be consumed in the FIFO.
40 int available_blocks() const { return available_blocks_; } 40 int available_blocks() const { return available_blocks_; }
41 41
42 // Number of available frames of data in the FIFO.
43 int GetAvailableFrames() const;
44
42 // Number of unfilled frames in the whole FIFO. 45 // Number of unfilled frames in the whole FIFO.
43 int GetUnfilledFrames() const; 46 int GetUnfilledFrames() const;
44 47
45 private: 48 private:
46 // The actual FIFO is a vector of audio buses. 49 // The actual FIFO is a vector of audio buses.
47 ScopedVector<AudioBus> audio_blocks_; 50 ScopedVector<AudioBus> audio_blocks_;
48 51
49 // Maximum number of frames of data one block of memory can contain. 52 // Maximum number of frames of data one block of memory can contain.
50 // This value is set by |frames| in the constructor. 53 // This value is set by |frames| in the constructor.
51 const int block_frames_; 54 const int block_frames_;
52 55
53 // Used to keep track which block of memory to be written. 56 // Used to keep track which block of memory to be written.
54 int write_block_; 57 int write_block_;
55 58
56 // Used to keep track which block of memory to be consumed. 59 // Used to keep track which block of memory to be consumed.
57 int read_block_; 60 int read_block_;
58 61
59 // Number of available blocks of memory to be consumed. 62 // Number of available blocks of memory to be consumed.
60 int available_blocks_; 63 int available_blocks_;
61 64
62 // Current write position in the current written block. 65 // Current write position in the current written block.
63 int write_pos_; 66 int write_pos_;
64 67
65 DISALLOW_COPY_AND_ASSIGN(AudioBlockFifo); 68 DISALLOW_COPY_AND_ASSIGN(AudioBlockFifo);
66 }; 69 };
67 70
68 } // namespace media 71 } // namespace media
69 72
70 #endif // MEDIA_BASE_AUDIO_BLOCK_FIFO_H_ 73 #endif // MEDIA_BASE_AUDIO_BLOCK_FIFO_H_
OLDNEW
« no previous file with comments | « media/audio/pulse/pulse_input.cc ('k') | media/base/audio_block_fifo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698