- fix the compiler warning + propagate opus decoder return code properly

This commit is contained in:
Dmytro Bogovych 2023-03-23 11:32:34 +03:00
parent 1b41ac9e16
commit b1cc4d1509
1 changed files with 4 additions and 3 deletions

View File

@ -520,12 +520,13 @@ int OpusCodec::plc(int lostFrames, void* output, int outputCapacity)
{ {
int nrOfSamplesInFrame = pcmLength() / (sizeof(short) * channels()); int nrOfSamplesInFrame = pcmLength() / (sizeof(short) * channels());
memset(output, 0, outputCapacity); memset(output, 0, outputCapacity);
int nr_of_decoded_samples = 0;
for (int i=0; i<lostFrames; i++) for (int i=0; i<lostFrames; i++)
{ {
/*int decodedSamples = */opus_decode(mDecoderCtx, NULL, 0, (opus_int16*)output + nrOfSamplesInFrame * i, nrOfSamplesInFrame, 0); nr_of_decoded_samples += opus_decode(mDecoderCtx, nullptr, 0, (opus_int16*)output + nrOfSamplesInFrame * i, nrOfSamplesInFrame, 0);
} }
return lostFrames * pcmLength(); return nr_of_decoded_samples ? lostFrames * pcmLength() : 0;
} }
#endif #endif