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

Unified Diff: webrtc/modules/audio_processing/include/audio_processing.h

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/include/audio_processing.h
diff --git a/webrtc/modules/audio_processing/include/audio_processing.h b/webrtc/modules/audio_processing/include/audio_processing.h
index fd91bfafbf384d036c2a8606268ee9ccad610250..445d5c8c247886fbb8b7273ebc8ee48d9a433738 100644
--- a/webrtc/modules/audio_processing/include/audio_processing.h
+++ b/webrtc/modules/audio_processing/include/audio_processing.h
@@ -311,7 +311,7 @@ class AudioProcessing {
//
// TODO(mgraczyk): Remove once clients are updated to use the new interface.
virtual int ProcessStream(const float* const* src,
- int samples_per_channel,
+ size_t samples_per_channel,
int input_sample_rate_hz,
ChannelLayout input_layout,
int output_sample_rate_hz,
@@ -357,7 +357,7 @@ class AudioProcessing {
// of |data| points to a channel buffer, arranged according to |layout|.
// TODO(mgraczyk): Remove once clients are updated to use the new interface.
virtual int AnalyzeReverseStream(const float* const* data,
- int samples_per_channel,
+ size_t samples_per_channel,
int rev_sample_rate_hz,
ChannelLayout layout) = 0;
@@ -510,8 +510,8 @@ class StreamConfig {
int num_channels() const { return num_channels_; }
bool has_keyboard() const { return has_keyboard_; }
- int num_frames() const { return num_frames_; }
- int num_samples() const { return num_channels_ * num_frames_; }
+ size_t num_frames() const { return num_frames_; }
+ size_t num_samples() const { return num_channels_ * num_frames_; }
bool operator==(const StreamConfig& other) const {
return sample_rate_hz_ == other.sample_rate_hz_ &&
@@ -522,14 +522,15 @@ class StreamConfig {
bool operator!=(const StreamConfig& other) const { return !(*this == other); }
private:
- static int calculate_frames(int sample_rate_hz) {
- return AudioProcessing::kChunkSizeMs * sample_rate_hz / 1000;
+ static size_t calculate_frames(int sample_rate_hz) {
+ return static_cast<size_t>(
+ AudioProcessing::kChunkSizeMs * sample_rate_hz / 1000);
}
int sample_rate_hz_;
int num_channels_;
bool has_keyboard_;
- int num_frames_;
+ size_t num_frames_;
};
class ProcessingConfig {

Powered by Google App Engine
This is Rietveld 408576698