Audio: Pipewire cleanups and fixes #4250
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A few Pipewire fixes and cleanups, including a fix for a race condition.
Since Pipewire starts it's own processing threads, we can wind up in the processing callbacks before all of the members of SDL_AudioDevice (callbackspec, work_buffer and stream) are actually allocated/initialized, as they aren't initialized until after the call to the driver's OpenDevice() function returns. We don't want to touch any of these until the device state is set to unpaused, which can only happen once initialization is fully complete.
Other than that, some redundant locks were removed and stream creation now blocks instead of spinning until the stream state is ready or failed, as creating streams can sometimes take quite a bit of time and busy waiting for many milliseconds isn't ideal.