mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-10-14 03:20:22 +00:00
[client] audio: increase startup latency
Underruns can still happen quite easily at the beginning of playback, particularly at very low latency settings. Further increase the startup latency to avoid this.
This commit is contained in:

committed by
Geoffrey McRae

parent
5e1b8f2abe
commit
0d97a51802
@@ -612,9 +612,17 @@ void audio_playbackData(uint8_t * data, size_t size)
|
||||
|
||||
if (audio.playback.state == STREAM_STATE_SETUP)
|
||||
{
|
||||
frames = ringbuffer_getCount(audio.playback.buffer);
|
||||
if (audio.audioDev->playback.start(frames))
|
||||
// In the worst case, the audio device can immediately request two full
|
||||
// buffers at the beginning of playback. Latency corrections at startup can
|
||||
// also be quite significant due to poor packet pacing from Spice, so
|
||||
// additionally require at least two full Spice periods' worth of data
|
||||
// before starting playback to minimise the chances of underrunning
|
||||
int startFrames =
|
||||
spiceData->periodFrames * 2 + audio.playback.deviceMaxPeriodFrames * 2;
|
||||
if (spiceData->nextPosition >= startFrames) {
|
||||
audio.audioDev->playback.start();
|
||||
audio.playback.state = STREAM_STATE_RUN;
|
||||
}
|
||||
}
|
||||
|
||||
double latencyFrames = actualOffset;
|
||||
|
Reference in New Issue
Block a user