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

Side by Side Diff: webrtc/modules/audio_coding/codecs/isac/fix/source/bandwidth_estimator.c

Issue 1227163003: Update audio code to use size_t more correctly, (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Review comments 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) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 * jitter as estimated by other side 141 * jitter as estimated by other side
142 * 142 *
143 * Return value : 0 if everything went fine, 143 * Return value : 0 if everything went fine,
144 * -1 otherwise 144 * -1 otherwise
145 */ 145 */
146 int32_t WebRtcIsacfix_UpdateUplinkBwImpl(BwEstimatorstr *bweStr, 146 int32_t WebRtcIsacfix_UpdateUplinkBwImpl(BwEstimatorstr *bweStr,
147 const uint16_t rtpNumber, 147 const uint16_t rtpNumber,
148 const int16_t frameSize, 148 const int16_t frameSize,
149 const uint32_t sendTime, 149 const uint32_t sendTime,
150 const uint32_t arrivalTime, 150 const uint32_t arrivalTime,
151 const int16_t pksize, 151 const size_t pksize,
152 const uint16_t Index) 152 const uint16_t Index)
153 { 153 {
154 uint16_t weight = 0; 154 uint16_t weight = 0;
155 uint32_t currBwInv = 0; 155 uint32_t currBwInv = 0;
156 uint16_t recRtpRate; 156 uint16_t recRtpRate;
157 uint32_t arrTimeProj; 157 uint32_t arrTimeProj;
158 int32_t arrTimeDiff; 158 int32_t arrTimeDiff;
159 int32_t arrTimeNoise; 159 int32_t arrTimeNoise;
160 int32_t arrTimeNoiseAbs; 160 int32_t arrTimeNoiseAbs;
161 int32_t sendTimeDiff; 161 int32_t sendTimeDiff;
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 arrTimeDiff = frameSizeSampl + kSamplesIn25msec; 372 arrTimeDiff = frameSizeSampl + kSamplesIn25msec;
373 } 373 }
374 374
375 /* don't allow it to be less than frame rate - 10 ms */ 375 /* don't allow it to be less than frame rate - 10 ms */
376 if (arrTimeDiff < frameSizeSampl - FRAMESAMPLES_10ms) { 376 if (arrTimeDiff < frameSizeSampl - FRAMESAMPLES_10ms) {
377 arrTimeDiff = frameSizeSampl - FRAMESAMPLES_10ms; 377 arrTimeDiff = frameSizeSampl - FRAMESAMPLES_10ms;
378 } 378 }
379 379
380 /* compute inverse receiving rate for last packet, in Q19 */ 380 /* compute inverse receiving rate for last packet, in Q19 */
381 numBytesInv = (uint16_t) WebRtcSpl_DivW32W16( 381 numBytesInv = (uint16_t) WebRtcSpl_DivW32W16(
382 524288 + ((pksize + HEADER_SIZE) >> 1), 382 (int32_t)(524288 + ((pksize + HEADER_SIZE) >> 1)),
383 (int16_t)(pksize + HEADER_SIZE)); 383 (int16_t)(pksize + HEADER_SIZE));
384 384
385 /* 8389 is ~ 1/128000 in Q30 */ 385 /* 8389 is ~ 1/128000 in Q30 */
386 byteSecondsPerBit = (uint32_t)(arrTimeDiff * 8389); 386 byteSecondsPerBit = (uint32_t)(arrTimeDiff * 8389);
387 387
388 /* get upper N bits */ 388 /* get upper N bits */
389 tempUpper = WEBRTC_SPL_RSHIFT_U32(byteSecondsPerBit, 15); 389 tempUpper = WEBRTC_SPL_RSHIFT_U32(byteSecondsPerBit, 15);
390 390
391 /* get lower 15 bits */ 391 /* get lower 15 bits */
392 tempLower = byteSecondsPerBit & 0x00007FFF; 392 tempLower = byteSecondsPerBit & 0x00007FFF;
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 /*s2nr = -1*(a_60 << 10) + ((b_60 * bottle_neck) >> 10);*/ 1029 /*s2nr = -1*(a_60 << 10) + ((b_60 * bottle_neck) >> 10);*/
1030 s2nr = -22500 + (int16_t)(500 * bottle_neck >> 10); 1030 s2nr = -22500 + (int16_t)(500 * bottle_neck >> 10);
1031 break; 1031 break;
1032 default: 1032 default:
1033 s2nr = -1; /* Error */ 1033 s2nr = -1; /* Error */
1034 } 1034 }
1035 1035
1036 return s2nr; //return in Q10 1036 return s2nr; //return in Q10
1037 1037
1038 } 1038 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698