Removing dead code in NetEQ

This CL should resolve Coverity DefectIds 14004, 14017, 14018, 14019.
Mostly harmless dead code, but also a bug in WebRtcNetEQ_RedundancySplit.
(The bug would only trigger if more than 2 redundancy payloads were sent
in the same packet.)

BUG=Coverity DefectIds 14004, 14017, 14018, 14019.
TEST=trybots, neteq_unittests, audio_coding_module_test.

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2739 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrik.lundin@webrtc.org 2012-09-11 12:44:06 +00:00
parent b43f85ffd3
commit f0effa12d9
4 changed files with 11 additions and 14 deletions

View File

@ -726,12 +726,18 @@ WebRtc_UWord16 WebRtcNetEQ_DbGetSampleRate(CodecDbInst_t *inst, int payloadType)
{
switch (i)
{
#ifdef NETEQ_WIDEBAND
case 1:
return 16000;
#endif
#ifdef NETEQ_32KHZ_WIDEBAND
case 2:
return 32000;
#endif
#ifdef NETEQ_48KHZ_WIDEBAND
case 3:
return 48000;
#endif
default:
return 8000;
}

View File

@ -173,8 +173,8 @@ WebRtc_Word16 WebRtcNetEQ_DTMFGenerate(dtmf_tone_inst_t *DTMFdecInst, WebRtc_Wor
WebRtc_Word16 a2 = 0; /* a-coefficient for second tone (high tone) */
int i;
int frameLen; /* number of samples to generate */
int lowIndex;
int highIndex;
int lowIndex = 0; /* Default to avoid compiler warnings. */
int highIndex = 4; /* Default to avoid compiler warnings. */
WebRtc_Word32 tempVal;
WebRtc_Word16 tempValLow;
WebRtc_Word16 tempValHigh;
@ -309,10 +309,6 @@ WebRtc_Word16 WebRtcNetEQ_DTMFGenerate(dtmf_tone_inst_t *DTMFdecInst, WebRtc_Wor
highIndex = 7;/* high frequency: 1633 Hz */
break;
}
default:
{
return DTMF_DEC_PARAMETER_ERROR;
}
} /* end switch */
/* select coefficients based on results from switches above */

View File

@ -138,7 +138,7 @@ int WebRtcNetEQ_RedundancySplit(RTPPacket_t* RTPheader[], int i_MaximumPayloads,
else
{
/* Discard all but the two last payloads. */
while (((pw16_data[2] & 0x8000) == 1)&&
while (((pw16_data[2] & 0x8000) != 0) &&
(pw16_data<((RTPheader[0]->payload)+((RTPheader[0]->payloadLen+1)>>1))))
{
i_discardedBlockLength += (4+(((WebRtc_UWord16)pw16_data[1]) & 0x3FF));
@ -167,7 +167,7 @@ int WebRtcNetEQ_RedundancySplit(RTPPacket_t* RTPheader[], int i_MaximumPayloads,
else
{
/* Discard all but the two last payloads. */
while (((pw16_data[2] & 0x80) == 1) && (pw16_data < ((RTPheader[0]->payload)
while (((pw16_data[2] & 0x80) != 0) && (pw16_data < ((RTPheader[0]->payload)
+ ((RTPheader[0]->payloadLen + 1) >> 1))))
{
i_discardedBlockLength += (4 + ((((WebRtc_UWord16) pw16_data[1]) & 0x3) << 8)

View File

@ -345,12 +345,7 @@ int WebRtcNetEQ_GetRecommendedBufferSize(void *inst, const enum WebRtcNetEQDecod
}
*MaxNoOfPackets = (*MaxNoOfPackets) * multiplier;
*sizeinbytes = (*sizeinbytes) * multiplier;
if (ok != 0)
{
NetEqMainInst->ErrorCode = -ok;
return (-1);
}
return (ok);
return 0;
}
int WebRtcNetEQ_AssignBuffer(void *inst, int MaxNoOfPackets, void *NETEQ_Buffer_Addr,