Skip to content

PulseAudio improvements#546

Open
arch1t3cht wants to merge 13 commits intomasterfrom
pa_fixes
Open

PulseAudio improvements#546
arch1t3cht wants to merge 13 commits intomasterfrom
pa_fixes

Conversation

@arch1t3cht
Copy link
Member

Add RAII wrappers for all the handles and stick locks everywhere. Waiting for some people to test this branch before merging.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments