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

Side by Side Diff: webrtc/modules/audio_coding/main/test/SpatialAudio.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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 const double rightPanning) { 152 const double rightPanning) {
153 AudioFrame audioFrame; 153 AudioFrame audioFrame;
154 int32_t outFileSampFreq = _outFile.SamplingFrequency(); 154 int32_t outFileSampFreq = _outFile.SamplingFrequency();
155 155
156 const double rightToLeftRatio = rightPanning / leftPanning; 156 const double rightToLeftRatio = rightPanning / leftPanning;
157 157
158 _channel->SetIsStereo(true); 158 _channel->SetIsStereo(true);
159 159
160 while (!_inFile.EndOfFile()) { 160 while (!_inFile.EndOfFile()) {
161 _inFile.Read10MsData(audioFrame); 161 _inFile.Read10MsData(audioFrame);
162 for (int n = 0; n < audioFrame.samples_per_channel_; n++) { 162 for (size_t n = 0; n < audioFrame.samples_per_channel_; n++) {
163 audioFrame.data_[n] = (int16_t) floor( 163 audioFrame.data_[n] = (int16_t) floor(
164 audioFrame.data_[n] * leftPanning + 0.5); 164 audioFrame.data_[n] * leftPanning + 0.5);
165 } 165 }
166 CHECK_ERROR(_acmLeft->Add10MsData(audioFrame)); 166 CHECK_ERROR(_acmLeft->Add10MsData(audioFrame));
167 167
168 for (int n = 0; n < audioFrame.samples_per_channel_; n++) { 168 for (size_t n = 0; n < audioFrame.samples_per_channel_; n++) {
169 audioFrame.data_[n] = (int16_t) floor( 169 audioFrame.data_[n] = (int16_t) floor(
170 audioFrame.data_[n] * rightToLeftRatio + 0.5); 170 audioFrame.data_[n] * rightToLeftRatio + 0.5);
171 } 171 }
172 CHECK_ERROR(_acmRight->Add10MsData(audioFrame)); 172 CHECK_ERROR(_acmRight->Add10MsData(audioFrame));
173 173
174 CHECK_ERROR(_acmReceiver->PlayoutData10Ms(outFileSampFreq, &audioFrame)); 174 CHECK_ERROR(_acmReceiver->PlayoutData10Ms(outFileSampFreq, &audioFrame));
175 _outFile.Write10MsData(audioFrame); 175 _outFile.Write10MsData(audioFrame);
176 } 176 }
177 _inFile.Rewind(); 177 _inFile.Rewind();
178 } 178 }
179 179
180 void SpatialAudio::EncodeDecode() { 180 void SpatialAudio::EncodeDecode() {
181 AudioFrame audioFrame; 181 AudioFrame audioFrame;
182 int32_t outFileSampFreq = _outFile.SamplingFrequency(); 182 int32_t outFileSampFreq = _outFile.SamplingFrequency();
183 183
184 _channel->SetIsStereo(false); 184 _channel->SetIsStereo(false);
185 185
186 while (!_inFile.EndOfFile()) { 186 while (!_inFile.EndOfFile()) {
187 _inFile.Read10MsData(audioFrame); 187 _inFile.Read10MsData(audioFrame);
188 CHECK_ERROR(_acmLeft->Add10MsData(audioFrame)); 188 CHECK_ERROR(_acmLeft->Add10MsData(audioFrame));
189 189
190 CHECK_ERROR(_acmReceiver->PlayoutData10Ms(outFileSampFreq, &audioFrame)); 190 CHECK_ERROR(_acmReceiver->PlayoutData10Ms(outFileSampFreq, &audioFrame));
191 _outFile.Write10MsData(audioFrame); 191 _outFile.Write10MsData(audioFrame);
192 } 192 }
193 _inFile.Rewind(); 193 _inFile.Rewind();
194 } 194 }
195 195
196 } // namespace webrtc 196 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/main/test/PCMFile.cc ('k') | webrtc/modules/audio_coding/main/test/initial_delay_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698