- properly handle the badly decoded audio (which can happen due to payload type <-> codec inconsistency)

This commit is contained in:
2024-11-16 16:33:21 +03:00
parent 9afbd9e0fd
commit 4d7ca3e4f3
2 changed files with 3 additions and 2 deletions

View File

@@ -519,6 +519,8 @@ int OpusCodec::decode(const void* input, int inputBytes, void* output, int outpu
int nr_of_frames = opus_decoder_get_nb_samples(mDecoderCtx, (const unsigned char *) input,
inputBytes);
if (nr_of_frames <= 0)
return 0;
// We support stereo and mono here.
int buffer_capacity = nr_of_frames * sizeof(opus_int16) * nr_of_channels;