Skip to content
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

Fix leak when using audio samples instead of streams #96572

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

adamscott
Copy link
Member

Fixes #96068

The issue was caused by the fact that the Ref<AudioStreamPlayback> deletion from AudioServer::playback_list was done in the AudioServer::_mix_step() function. When a stream was replaced, it was tagged to be faded out. And when the fading was done, it was promptly deleted/unreferenced.

The thing is that samples never trigger _mix_step(), thus never clearing those references.

I now implemented the deletion in a function that _mix_step() calls and that AudioServer::stop_playback_stream() calls too. The later calls it if the stream is stopped, flagged as containing a sample, and that it's reference to the sample is nullptr.

@adamscott adamscott added bug platform:web topic:porting topic:audio cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release labels Sep 4, 2024
@adamscott adamscott added this to the 4.4 milestone Sep 4, 2024
@adamscott adamscott requested review from a team as code owners September 4, 2024 16:33
@adamscott adamscott mentioned this pull request Sep 4, 2024
@akien-mga akien-mga merged commit 493f3ed into godotengine:master Sep 9, 2024
20 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release platform:web topic:audio topic:porting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Audio samples leaks
2 participants