Resolved Coverity warnings.

This CL includes changes to resolve Coverity warnings 14086, 14110 and 14111.

Tested with trybots and audioproc_unittests.

BUG=None
TEST=None

Review URL: https://webrtc-codereview.appspot.com/606004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2321 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
bjornv@webrtc.org 2012-05-30 07:41:57 +00:00
parent b5ea03adbb
commit 281b7983db
5 changed files with 27 additions and 28 deletions

View File

@ -777,7 +777,7 @@ static void ProcessBlock(aec_t* aec) {
memcpy(aec->xfBuf[1] + aec->xfBufBlockPos * PART_LEN1, &xf_ptr[PART_LEN1],
sizeof(float) * PART_LEN1);
memset(yf[0], 0, sizeof(float) * (PART_LEN1 * 2));
memset(yf, 0, sizeof(yf));
// Filter far
WebRtcAec_FilterFar(aec, yf);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@ -71,21 +71,24 @@ int WebRtcAec_FreeResampler(void *resampInst)
return 0;
}
int WebRtcAec_ResampleLinear(void *resampInst,
const short *inspeech,
int size,
float skew,
short *outspeech)
void WebRtcAec_ResampleLinear(void *resampInst,
const short *inspeech,
int size,
float skew,
short *outspeech,
int *size_out)
{
resampler_t *obj = (resampler_t*) resampInst;
short *y;
float be, tnew, interp;
int tn, outsize, mm;
int tn, mm;
if (size < 0 || size > 2 * FRAME_LEN) {
return -1;
}
assert(!(size < 0 || size > 2 * FRAME_LEN));
assert(resampInst != NULL);
assert(inspeech != NULL);
assert(outspeech != NULL);
assert(size_out != NULL);
// Add new frame data in lookahead
memcpy(&obj->buffer[FRAME_LEN + kResamplingDelay],
@ -121,15 +124,13 @@ int WebRtcAec_ResampleLinear(void *resampInst,
tn = (int) tnew;
}
outsize = mm;
obj->position += outsize * be - size;
*size_out = mm;
obj->position += (*size_out) * be - size;
// Shift buffer
memmove(obj->buffer,
&obj->buffer[size],
(kResamplerBufferSize - size) * sizeof(short));
return outsize;
}
int WebRtcAec_GetSkew(void *resampInst, int rawSkew, float *skewEst)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@ -25,11 +25,11 @@ int WebRtcAec_FreeResampler(void *resampInst);
int WebRtcAec_GetSkew(void *resampInst, int rawSkew, float *skewEst);
// Resamples input using linear interpolation.
// Returns size of resampled array.
int WebRtcAec_ResampleLinear(void *resampInst,
const short *inspeech,
int size,
float skew,
short *outspeech);
void WebRtcAec_ResampleLinear(void *resampInst,
const short *inspeech,
int size,
float skew,
short *outspeech,
int *size_out);
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_RESAMPLER_H_

View File

@ -276,11 +276,8 @@ WebRtc_Word32 WebRtcAec_BufferFarend(void *aecInst, const WebRtc_Word16 *farend,
if (aecpc->skewMode == kAecTrue && aecpc->resample == kAecTrue) {
// Resample and get a new number of samples
newNrOfSamples = WebRtcAec_ResampleLinear(aecpc->resampler,
farend,
nrOfSamples,
skew,
newFarend);
WebRtcAec_ResampleLinear(aecpc->resampler, farend, nrOfSamples, skew,
newFarend, &newNrOfSamples);
farend_ptr = (const int16_t*) newFarend;
}

View File

@ -1650,9 +1650,10 @@ int WebRtcAgc_Init(void *agcInst, WebRtc_Word32 minLevel, WebRtc_Word32 maxLevel
{
stt->Rxx16w32_array[0][i] = 0;
}
for (i = 0; i < 20; i++)
for (i = 0; i < 10; i++)
{
stt->env[0][i] = 0;
stt->env[1][i] = 0;
}
stt->inQueue = 0;