Index: webrtc/common_audio/channel_buffer.h |
diff --git a/webrtc/common_audio/channel_buffer.h b/webrtc/common_audio/channel_buffer.h |
index a5dcc6c2641011f683def5c6ca1a0fa0983d9a4b..00ea733248fec7fa0cb8846e26e7d9d1ad4538f7 100644 |
--- a/webrtc/common_audio/channel_buffer.h |
+++ b/webrtc/common_audio/channel_buffer.h |
@@ -39,9 +39,9 @@ namespace webrtc { |
template <typename T> |
class ChannelBuffer { |
public: |
- ChannelBuffer(int num_frames, |
+ ChannelBuffer(size_t num_frames, |
int num_channels, |
- int num_bands = 1) |
+ size_t num_bands = 1) |
: data_(new T[num_frames * num_channels]()), |
channels_(new T*[num_channels * num_bands]), |
bands_(new T*[num_channels * num_bands]), |
@@ -50,7 +50,7 @@ class ChannelBuffer { |
num_channels_(num_channels), |
num_bands_(num_bands) { |
for (int i = 0; i < num_channels_; ++i) { |
- for (int j = 0; j < num_bands_; ++j) { |
+ for (size_t j = 0; j < num_bands_; ++j) { |
channels_[j * num_channels_ + i] = |
&data_[i * num_frames_ + j * num_frames_per_band_]; |
bands_[i * num_bands_ + j] = channels_[j * num_channels_ + i]; |
@@ -74,12 +74,11 @@ class ChannelBuffer { |
// 0 <= band < |num_bands_| |
// 0 <= channel < |num_channels_| |
// 0 <= sample < |num_frames_per_band_| |
- const T* const* channels(int band) const { |
+ const T* const* channels(size_t band) const { |
DCHECK_LT(band, num_bands_); |
- DCHECK_GE(band, 0); |
return &channels_[band * num_channels_]; |
} |
- T* const* channels(int band) { |
+ T* const* channels(size_t band) { |
const ChannelBuffer<T>* t = this; |
return const_cast<T* const*>(t->channels(band)); |
} |
@@ -103,21 +102,21 @@ class ChannelBuffer { |
// Sets the |slice| pointers to the |start_frame| position for each channel. |
// Returns |slice| for convenience. |
- const T* const* Slice(T** slice, int start_frame) const { |
+ const T* const* Slice(T** slice, size_t start_frame) const { |
DCHECK_LT(start_frame, num_frames_); |
for (int i = 0; i < num_channels_; ++i) |
slice[i] = &channels_[i][start_frame]; |
return slice; |
} |
- T** Slice(T** slice, int start_frame) { |
+ T** Slice(T** slice, size_t start_frame) { |
const ChannelBuffer<T>* t = this; |
return const_cast<T**>(t->Slice(slice, start_frame)); |
} |
- int num_frames() const { return num_frames_; } |
- int num_frames_per_band() const { return num_frames_per_band_; } |
+ size_t num_frames() const { return num_frames_; } |
+ size_t num_frames_per_band() const { return num_frames_per_band_; } |
int num_channels() const { return num_channels_; } |
- int num_bands() const { return num_bands_; } |
+ size_t num_bands() const { return num_bands_; } |
size_t size() const {return num_frames_ * num_channels_; } |
void SetDataForTesting(const T* data, size_t size) { |
@@ -129,10 +128,10 @@ class ChannelBuffer { |
rtc::scoped_ptr<T[]> data_; |
rtc::scoped_ptr<T* []> channels_; |
rtc::scoped_ptr<T* []> bands_; |
- const int num_frames_; |
- const int num_frames_per_band_; |
+ const size_t num_frames_; |
+ const size_t num_frames_per_band_; |
const int num_channels_; |
- const int num_bands_; |
+ const size_t num_bands_; |
}; |
// One int16_t and one float ChannelBuffer that are kept in sync. The sync is |
@@ -143,17 +142,17 @@ class ChannelBuffer { |
// fbuf() until the next call to any of the other functions. |
class IFChannelBuffer { |
public: |
- IFChannelBuffer(int num_frames, int num_channels, int num_bands = 1); |
+ IFChannelBuffer(size_t num_frames, int num_channels, size_t num_bands = 1); |
ChannelBuffer<int16_t>* ibuf(); |
ChannelBuffer<float>* fbuf(); |
const ChannelBuffer<int16_t>* ibuf_const() const; |
const ChannelBuffer<float>* fbuf_const() const; |
- int num_frames() const { return ibuf_.num_frames(); } |
- int num_frames_per_band() const { return ibuf_.num_frames_per_band(); } |
+ size_t num_frames() const { return ibuf_.num_frames(); } |
+ size_t num_frames_per_band() const { return ibuf_.num_frames_per_band(); } |
int num_channels() const { return ibuf_.num_channels(); } |
- int num_bands() const { return ibuf_.num_bands(); } |
+ size_t num_bands() const { return ibuf_.num_bands(); } |
private: |
void RefreshF() const; |