Skip to content

Backport "Merge PR #5648: FIX(client): Prevent endless loop when disconnecting PipeWire stream" to 1.4.x#5651

Merged
Krzmbrzl merged 1 commit intomumble-voip:1.4.xfrom
Krzmbrzl:backport/1.4.x/pr-5648
May 8, 2022
Merged

Backport "Merge PR #5648: FIX(client): Prevent endless loop when disconnecting PipeWire stream" to 1.4.x#5651
Krzmbrzl merged 1 commit intomumble-voip:1.4.xfrom
Krzmbrzl:backport/1.4.x/pr-5648

Conversation

@Krzmbrzl
Copy link
Member

@Krzmbrzl Krzmbrzl commented May 8, 2022

Backport

This will backport the following commits from master to 1.4.x:

Questions ?

Please refer to the Backport tool documentation

Since version 0.3.51, PipeWire has support for buffers with a size of 0
being passed in the process callback. More specifically, this feature
was added in commit 96286fb8b11658a0fdaa61194504a3f9541b25e6 ("resample:
use a -1 buffer size to drain") in PipeWire [1].

Unfortunately, this causes an endless loop, because we try to destroy
the PipeWire stream, but it keeps waiting for the node to be completely
drained, which now never happens because it keeps calling
processCallback() where we feed buffers with a size of 0 to it.

To fix this problem, we do not longer pass 0-size buffers to PipeWire.
Instead we now push silence, if we don't have any data available. This
is what PipeWire prefers anyway, the process callback wants a buffer to
be filled. If we don't do that, the node will stay in
SPA_STATUS_NEED_DATA state and even if we ignore the obvious endless
loop error, this can cause other problems.
For example above mentioned commit was fixed in PipeWire with
32e957345d63a6d6e3d223057d764ff661f5d101 ("audioadapter: don't loop
forever") [2], which is better than the endless loop but still
preventable.
So in order to avoid unnecessary xruns, we push silence instead of empty
buffers.

Fixes mumble-voip#5647

[1] https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/96286fb8b11658a0fdaa61194504a3f9541b25e7
[2] https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/32e957345d63a6d6e3d223057d764ff661f5d101

(cherry picked from commit f244b13)
@vimpostor
Copy link
Contributor

Out of interest, when can we expect the first bugfix release in the 1.4 series? The initial 1.4 release is already half a year in the past, so now might be the best moment.

If you decide to do the bugfix release, feel free to ping me one day prior. I can update the GTA 5 positional audio plugin again, so that we finally have a release where the plugin is not already outdated again.

@Krzmbrzl
Copy link
Member Author

Krzmbrzl commented May 8, 2022

The reason you see all these backport PRs is that my plan is exactly to create a new 1.4 release. When exactly it will ship, I can't tell as that will depend on how much time I find and when. But the goal is to release it somewhat soon-ish.

@Krzmbrzl Krzmbrzl deleted the backport/1.4.x/pr-5648 branch November 9, 2022 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments