Open
Conversation
As far as I can tell the mainloop needs to be locked when the context is disconnected and freed, so we cannot simply use an std::unique_ptr here. So, while we're at it, add some additional convenience methods like get_errno() too, and handle a connection failure. Most importantly, lock the mainloop while connecting: This missing lock seems to be one of the main causes of PulseAudio-related crashes.
This is a one-to-one replace for now; the missing locks will be fixed in the following commits.
None of these are used anyway, so don't bother writing a RAII wrapper.
Avoid confusion due to two having two different pa_stream_write functions.
In particular stop using a shared paerror member variable.
Apart from this being the technique recommended in the documentation and cutting down on wxWidgets usage, this is needed to prevent deadlocks when the mainloop is locked while connecting the context (which it needs to be but currently isn't). Since we now need to keep the pa_operations around to poll their status, add a RAII wrapper for those too.
As far as I can tell basically every operation not happening in a callback needs to be locked, so just lock once at the top level instead of locking for each operation individually. This makes the logic much easier to reason about too.
These were probably never necessary in the first place, but they're even less necessary now that there's proper locking around everything.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add RAII wrappers for all the handles and stick locks everywhere. Waiting for some people to test this branch before merging.