-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More audio buffering fixes (primarily affects SDL) #12916
Conversation
…king SYSPROP_AUDIO_FRAMES_PER_BUFFER into account.
…hanges to the Qt SDL code.
Just gonna go ahead and merge, I think it's pretty safe. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, this makes sense. Definitely more readable now...
-[Unknown]
@@ -248,7 +263,8 @@ unsigned int StereoResampler::Mix(short* samples, unsigned int numSamples, bool | |||
// Flush cached variable | |||
m_indexR.store(indexR); | |||
|
|||
return realSamples / 2; | |||
// TODO: What should we actually return here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think actually produced samples is best, then padding can be decided per platform.
-[Unknown]
Started with the assumption that something was wrong with the rate adjustment logic, but couldn't find anything, just bad variable names not describing what was going on. Instead it turned out that the target buffer size (which is what lowwatermark really was) simply was lower than the default buffer size in SDL, which can never work reliably, leading to #12705.
Eventually ended up clamping the target buffer size so it's always larger than the SDL buffer size with some margin, and also reduced the SDL buffer size from 2048 to 1024.
So this change could have been a bit smaller but I want to keep the renaming and minor refactorings I did.
I want to later change to SDL_QueueAudio but really wanted to get this solid first.
Ported the changes to the SDL audio code used by Qt, too (we should really share that...)
Fixes #12705 , hopefully.