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

Unified Diff: webrtc/modules/audio_processing/audio_buffer.cc

Issue 1230503003: Update a ton of audio code to use size_t more correctly and in general reduce (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_processing/audio_buffer.cc
diff --git a/webrtc/modules/audio_processing/audio_buffer.cc b/webrtc/modules/audio_processing/audio_buffer.cc
index 6f732624930fb5d04e8ed860dd442d71a9fc91a3..81790a159be933342591902f6c31dbfa22873cec 100644
--- a/webrtc/modules/audio_processing/audio_buffer.cc
+++ b/webrtc/modules/audio_processing/audio_buffer.cc
@@ -19,9 +19,9 @@
namespace webrtc {
namespace {
-const int kSamplesPer16kHzChannel = 160;
-const int kSamplesPer32kHzChannel = 320;
-const int kSamplesPer48kHzChannel = 480;
+const size_t kSamplesPer16kHzChannel = 160;
+const size_t kSamplesPer32kHzChannel = 320;
+const size_t kSamplesPer48kHzChannel = 480;
int KeyboardChannelIndex(const StreamConfig& stream_config) {
if (!stream_config.has_keyboard()) {
@@ -32,23 +32,22 @@ int KeyboardChannelIndex(const StreamConfig& stream_config) {
return stream_config.num_channels();
}
-int NumBandsFromSamplesPerChannel(int num_frames) {
- int num_bands = 1;
+size_t NumBandsFromSamplesPerChannel(size_t num_frames) {
+ size_t num_bands = 1;
if (num_frames == kSamplesPer32kHzChannel ||
num_frames == kSamplesPer48kHzChannel) {
- num_bands = rtc::CheckedDivExact(num_frames,
- static_cast<int>(kSamplesPer16kHzChannel));
+ num_bands = rtc::CheckedDivExact(num_frames, kSamplesPer16kHzChannel);
}
return num_bands;
}
} // namespace
-AudioBuffer::AudioBuffer(int input_num_frames,
+AudioBuffer::AudioBuffer(size_t input_num_frames,
int num_input_channels,
- int process_num_frames,
+ size_t process_num_frames,
int num_process_channels,
- int output_num_frames)
+ size_t output_num_frames)
: input_num_frames_(input_num_frames),
num_input_channels_(num_input_channels),
proc_num_frames_(process_num_frames),
@@ -345,20 +344,20 @@ void AudioBuffer::set_num_channels(int num_channels) {
num_channels_ = num_channels;
}
-int AudioBuffer::num_frames() const {
+size_t AudioBuffer::num_frames() const {
return proc_num_frames_;
}
-int AudioBuffer::num_frames_per_band() const {
+size_t AudioBuffer::num_frames_per_band() const {
return num_split_frames_;
}
-int AudioBuffer::num_keyboard_frames() const {
+size_t AudioBuffer::num_keyboard_frames() const {
// We don't resample the keyboard channel.
return input_num_frames_;
}
-int AudioBuffer::num_bands() const {
+size_t AudioBuffer::num_bands() const {
return num_bands_;
}
« no previous file with comments | « webrtc/modules/audio_processing/audio_buffer.h ('k') | webrtc/modules/audio_processing/audio_processing_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698