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

Unified Diff: webrtc/modules/audio_processing/vad/standalone_vad.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/vad/standalone_vad.cc
diff --git a/webrtc/modules/audio_processing/vad/standalone_vad.cc b/webrtc/modules/audio_processing/vad/standalone_vad.cc
index 783785184dbd017a7f33f41f4f7973df25a671d8..468b8ff3f02eb1eed4b5b113d2e9bc2c07d335eb 100644
--- a/webrtc/modules/audio_processing/vad/standalone_vad.cc
+++ b/webrtc/modules/audio_processing/vad/standalone_vad.cc
@@ -42,7 +42,7 @@ StandaloneVad* StandaloneVad::Create() {
return new StandaloneVad(vad);
}
-int StandaloneVad::AddAudio(const int16_t* data, int length) {
+int StandaloneVad::AddAudio(const int16_t* data, size_t length) {
if (length != kLength10Ms)
return -1;
@@ -57,11 +57,11 @@ int StandaloneVad::AddAudio(const int16_t* data, int length) {
return 0;
}
-int StandaloneVad::GetActivity(double* p, int length_p) {
+int StandaloneVad::GetActivity(double* p, size_t length_p) {
if (index_ == 0)
return -1;
- const int num_frames = index_ / kLength10Ms;
+ const size_t num_frames = index_ / kLength10Ms;
if (num_frames > length_p)
return -1;
assert(WebRtcVad_ValidRateAndFrameLength(kSampleRateHz, index_) == 0);
@@ -73,7 +73,7 @@ int StandaloneVad::GetActivity(double* p, int length_p) {
p[0] = 0.01; // Arbitrary but small and non-zero.
else
p[0] = 0.5; // 0.5 is neutral values when combinned by other probabilities.
- for (int n = 1; n < num_frames; n++)
+ for (size_t n = 1; n < num_frames; n++)
p[n] = p[0];
// Reset the buffer to start from the beginning.
index_ = 0;
« no previous file with comments | « webrtc/modules/audio_processing/vad/standalone_vad.h ('k') | webrtc/modules/audio_processing/vad/standalone_vad_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698