mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2025-01-08 09:18:43 +00:00
Increase audio buffer size to reduce the chance of underruns
This commit is contained in:
parent
c98289a9e7
commit
da1fcd49fc
1 changed files with 4 additions and 2 deletions
|
@ -28,8 +28,10 @@ bool SdlAudioRenderer::prepareForPlayback(const OPUS_MULTISTREAM_CONFIGURATION*
|
|||
|
||||
// On PulseAudio systems, setting a value too small can cause underruns for other
|
||||
// applications sharing this output device. We impose a floor of 480 samples (10 ms)
|
||||
// to mitigate this issue.
|
||||
want.samples = SDL_max(480, opusConfig->samplesPerFrame);
|
||||
// to mitigate this issue. Otherwise, we will buffer up to 3 frames of audio which
|
||||
// is 15 ms at regular 5 ms frames and 30 ms at 10 ms frames for slow connections.
|
||||
// The buffering helps avoid audio underruns due to network jitter.
|
||||
want.samples = SDL_max(480, opusConfig->samplesPerFrame * 3);
|
||||
|
||||
m_FrameSize = opusConfig->samplesPerFrame * sizeof(short) * opusConfig->channelCount;
|
||||
|
||||
|
|
Loading…
Reference in a new issue