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

Unified Diff: webrtc/modules/audio_coding/codecs/cng/webrtc_cng.c

Issue 1225173002: 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/codecs/cng/webrtc_cng.c
diff --git a/webrtc/modules/audio_coding/codecs/cng/webrtc_cng.c b/webrtc/modules/audio_coding/codecs/cng/webrtc_cng.c
index 1f6974a456250a4b280beeb100fc1b02352233c8..a0c166a6c37c7e06bac98f2d991aad2754ef9e5d 100644
--- a/webrtc/modules/audio_coding/codecs/cng/webrtc_cng.c
+++ b/webrtc/modules/audio_coding/codecs/cng/webrtc_cng.c
@@ -35,7 +35,7 @@ typedef struct WebRtcCngDecoder_ {
} WebRtcCngDecoder;
typedef struct WebRtcCngEncoder_ {
- int16_t enc_nrOfCoefs;
+ size_t enc_nrOfCoefs;
int enc_sampfreq;
int16_t enc_interval;
int16_t enc_msSinceSID;
@@ -228,8 +228,8 @@ int16_t WebRtcCng_FreeDec(CNG_dec_inst* cng_inst) {
* -1 - Error
*/
int WebRtcCng_Encode(CNG_enc_inst* cng_inst, int16_t* speech,
- int16_t nrOfSamples, uint8_t* SIDdata,
- int16_t* bytesOut, int16_t forceSID) {
+ size_t nrOfSamples, uint8_t* SIDdata,
+ size_t* bytesOut, int16_t forceSID) {
WebRtcCngEncoder* inst = (WebRtcCngEncoder*) cng_inst;
int16_t arCoefs[WEBRTC_CNG_MAX_LPC_ORDER + 1];
@@ -240,10 +240,11 @@ int WebRtcCng_Encode(CNG_enc_inst* cng_inst, int16_t* speech,
int16_t ReflBetaComp = 13107; /* 0.4 in q15. */
int32_t outEnergy;
int outShifts;
- int i, stab;
+ size_t i;
+ int stab;
int acorrScale;
- int index;
- int16_t ind, factor;
+ size_t index;
+ size_t ind, factor;
int32_t* bptr;
int32_t blo, bhi;
int16_t negate;
@@ -281,7 +282,7 @@ int WebRtcCng_Encode(CNG_enc_inst* cng_inst, int16_t* speech,
outShifts--;
}
}
- outEnergy = WebRtcSpl_DivW32W16(outEnergy, factor);
+ outEnergy = WebRtcSpl_DivW32W16(outEnergy, (int16_t)factor);
if (outEnergy > 1) {
/* Create Hanning Window. */
@@ -390,7 +391,7 @@ int WebRtcCng_Encode(CNG_enc_inst* cng_inst, int16_t* speech,
inst->enc_msSinceSID +=
(int16_t)((1000 * nrOfSamples) / inst->enc_sampfreq);
- return inst->enc_nrOfCoefs + 1;
+ return (int)(inst->enc_nrOfCoefs + 1);
} else {
inst->enc_msSinceSID +=
(int16_t)((1000 * nrOfSamples) / inst->enc_sampfreq);
@@ -475,10 +476,10 @@ int16_t WebRtcCng_UpdateSid(CNG_dec_inst* cng_inst, uint8_t* SID,
* -1 - Error
*/
int16_t WebRtcCng_Generate(CNG_dec_inst* cng_inst, int16_t* outData,
- int16_t nrOfSamples, int16_t new_period) {
+ size_t nrOfSamples, int16_t new_period) {
WebRtcCngDecoder* inst = (WebRtcCngDecoder*) cng_inst;
- int i;
+ size_t i;
int16_t excitation[WEBRTC_CNG_MAX_OUTSIZE_ORDER];
int16_t low[WEBRTC_CNG_MAX_OUTSIZE_ORDER];
int16_t lpPoly[WEBRTC_CNG_MAX_LPC_ORDER + 1];

Powered by Google App Engine
This is Rietveld 408576698