mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 13:37:22 +00:00
[client] audio: fix latency calculation if audio device starts early
If the audio device starts earlier than required, we slew the read pointer backwards to avoid underrunning. We need to apply this same offset to the recorded device position, otherwise the Spice thread will think playback is further ahead than it really is and inject unnecessary latency to compensate.
This commit is contained in:
parent
a13c90bd27
commit
0dad9b1e76
@ -227,7 +227,10 @@ static int playbackPullFrames(uint8_t * dst, int frames)
|
|||||||
int offset = ringbuffer_getCount(audio.playback.buffer) -
|
int offset = ringbuffer_getCount(audio.playback.buffer) -
|
||||||
audio.playback.deviceTargetStartFrames;
|
audio.playback.deviceTargetStartFrames;
|
||||||
if (offset < 0)
|
if (offset < 0)
|
||||||
|
{
|
||||||
|
data->nextPosition += offset;
|
||||||
ringbuffer_consume(audio.playback.buffer, NULL, offset);
|
ringbuffer_consume(audio.playback.buffer, NULL, offset);
|
||||||
|
}
|
||||||
|
|
||||||
audio.playback.state = STREAM_STATE_RUN;
|
audio.playback.state = STREAM_STATE_RUN;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user