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

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

Issue 557693003: Dynamically allocate more memory to AudioBlockFifo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed the comments. Created 6 years, 3 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
« 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 27 matching lines...) Expand all
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. 42 // Number of available frames of data in the FIFO.
43 int GetAvailableFrames() const; 43 int GetAvailableFrames() const;
44 44
45 // Number of unfilled frames in the whole FIFO. 45 // Number of unfilled frames in the whole FIFO.
46 int GetUnfilledFrames() const; 46 int GetUnfilledFrames() const;
47 47
48 // Dynamically increase |blocks| of memory to the FIFO.
49 void IncreaseCapacity(int blocks);
50
48 private: 51 private:
49 // The actual FIFO is a vector of audio buses. 52 // The actual FIFO is a vector of audio buses.
50 ScopedVector<AudioBus> audio_blocks_; 53 ScopedVector<AudioBus> audio_blocks_;
51 54
55 // Number of channels in AudioBus.
56 const int channels_;
57
52 // Maximum number of frames of data one block of memory can contain. 58 // Maximum number of frames of data one block of memory can contain.
53 // This value is set by |frames| in the constructor. 59 // This value is set by |frames| in the constructor.
54 const int block_frames_; 60 const int block_frames_;
55 61
56 // Used to keep track which block of memory to be written. 62 // Used to keep track which block of memory to be written.
57 int write_block_; 63 int write_block_;
58 64
59 // Used to keep track which block of memory to be consumed. 65 // Used to keep track which block of memory to be consumed.
60 int read_block_; 66 int read_block_;
61 67
62 // Number of available blocks of memory to be consumed. 68 // Number of available blocks of memory to be consumed.
63 int available_blocks_; 69 int available_blocks_;
64 70
65 // Current write position in the current written block. 71 // Current write position in the current written block.
66 int write_pos_; 72 int write_pos_;
67 73
68 DISALLOW_COPY_AND_ASSIGN(AudioBlockFifo); 74 DISALLOW_COPY_AND_ASSIGN(AudioBlockFifo);
69 }; 75 };
70 76
71 } // namespace media 77 } // namespace media
72 78
73 #endif // MEDIA_BASE_AUDIO_BLOCK_FIFO_H_ 79 #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