- send silence to audio decoder if packet is lost

This commit is contained in:
Dmytro Bogovych 2025-02-25 15:11:13 +03:00
parent f30e111ebe
commit efbf9c5bf8
1 changed files with 10 additions and 0 deletions

View File

@ -522,7 +522,17 @@ AudioReceiver::DecodeResult AudioReceiver::getAudio(Audio::DataWindow& output, i
if (options & DecodeOptions_SkipDecode)
mDecodedLength = 0;
else
{
mDecodedLength = mCodec->plc(mFrameCount, mDecodedFrame, sizeof mDecodedFrame);
if (!mDecodedLength)
{
// PLC is not support or failed
// So substitute the silence
size_t nr_of_samples = mCodec->frameTime() * mCodec->samplerate() / 1000 * sizeof(short);
mDecodedLength = nr_of_samples * sizeof(short);
memset(mDecodedFrame, 0, mDecodedLength);
}
}
}
if (mDecodedLength)