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

Unified Diff: webrtc/modules/audio_conference_mixer/source/audio_frame_manipulator.cc

Issue 1224123002: Update audio code to use size_t more correctly, webrtc/modules/ portion. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 5 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_conference_mixer/source/audio_frame_manipulator.cc
diff --git a/webrtc/modules/audio_conference_mixer/source/audio_frame_manipulator.cc b/webrtc/modules/audio_conference_mixer/source/audio_frame_manipulator.cc
index 3dce5c8bea68e787ede99a067e8af9298adff8f2..636698e9c10fc9da63c0f41583d043b88bee7e7b 100644
--- a/webrtc/modules/audio_conference_mixer/source/audio_frame_manipulator.cc
+++ b/webrtc/modules/audio_conference_mixer/source/audio_frame_manipulator.cc
@@ -35,14 +35,14 @@ const float rampArray[] = {0.0000f, 0.0127f, 0.0253f, 0.0380f,
0.8608f, 0.8734f, 0.8861f, 0.8987f,
0.9114f, 0.9241f, 0.9367f, 0.9494f,
0.9620f, 0.9747f, 0.9873f, 1.0000f};
-const int rampSize = sizeof(rampArray)/sizeof(rampArray[0]);
+const size_t rampSize = sizeof(rampArray)/sizeof(rampArray[0]);
} // namespace
namespace webrtc {
void CalculateEnergy(AudioFrame& audioFrame)
{
audioFrame.energy_ = 0;
- for(int position = 0; position < audioFrame.samples_per_channel_;
+ for(size_t position = 0; position < audioFrame.samples_per_channel_;
position++)
{
// TODO(andrew): this can easily overflow.
@@ -54,7 +54,7 @@ void CalculateEnergy(AudioFrame& audioFrame)
void RampIn(AudioFrame& audioFrame)
{
assert(rampSize <= audioFrame.samples_per_channel_);
- for(int i = 0; i < rampSize; i++)
+ for(size_t i = 0; i < rampSize; i++)
{
audioFrame.data_[i] = static_cast<int16_t>(rampArray[i] *
audioFrame.data_[i]);
@@ -64,9 +64,9 @@ void RampIn(AudioFrame& audioFrame)
void RampOut(AudioFrame& audioFrame)
{
assert(rampSize <= audioFrame.samples_per_channel_);
- for(int i = 0; i < rampSize; i++)
+ for(size_t i = 0; i < rampSize; i++)
{
- const int rampPos = rampSize - 1 - i;
+ const size_t rampPos = rampSize - 1 - i;
audioFrame.data_[i] = static_cast<int16_t>(rampArray[rampPos] *
audioFrame.data_[i]);
}

Powered by Google App Engine
This is Rietveld 408576698