SDL_QueueAudio underrun

Timothy Macintyre <[email protected]>
Newsgroups gmane.comp.lib.sdl
Message-ID <AM3PR05MB13306F91F1EADC4F11C68F96DAD20@AM3PR05MB1330.eurprd05.prod.outlook.com>
Hi,


I'm attempting to decode an opus audio stream and play it back using SDL2 but I'm having issues with a constantly growing audio delay.

It seems like the audio isn't getting moved to the audio device quick enough or is playing back for slightly too long causing a gradual increase in delay over time.

I've tried to limit the audio queue size as seen in the code below but this ends up causing small jitters in the audio. Any help on this would be greatly appreciated


if (SDL_GetQueuedAudioSize(dev) < 38400)
{
int output_samples = opus_decode(dec, (unsigned char*)entry->data, entry->length, decodedBuffer, FRAME_SIZE, 0);
if (output_samples > 0)
{
if (SDL_QueueAudio(dev, decodedBuffer, output_samples * CHANNEL_COUNT * sizeof(opus_int16)) < 0)
LOG_ERROR("error queuing audio: %s", SDL_GetError());
}
}
else {
SDL_ClearQueuedAudio(dev);
}


Regards,

Tim.

_______________________________________________
SDL mailing list
[email protected]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.