-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
[3.x] Fix crash in AudioServer when switching audio devices with different audio channels count #59778
[3.x] Fix crash in AudioServer when switching audio devices with different audio channels count #59778
Conversation
…audio channels count (connecting PS5 controller, bluetooth 5.1 headphones etc.)
Is this only relevant for |
@akien-mga I've just tried to reproduce it in |
A separate PR for |
What happens if the audio thread is actively mixing when this happens? I could imagine we might need to lock the AudioServer in this method before messing with the buffers? LGTM though, because this should fix it most of the time. |
@ellenhp I thought the same initially, but if I'm not mistaken |
@akien-mga I've approved both of these and I'll let you either merge both or merge into master and cherry-pick or whatever we want to do. @Listwon Thanks for figuring this out and fixing it! |
Thanks! |
Cherry-picked for 3.4.5. |
Fixes #52275
Switching audio devices with different audio channels count caused crashes in
AudioServer::_mix_step()
because it tried to access non-existent effects instances inbus->channels[k].effect_instances
.AudioServer::init_channels_and_buffers()
is called if there is change inget_channel_count()
. The update of effects (creating new effects instances) on new channels was missing here.