Skip to content

Workaround for #1064 - #1172

Closed
erfan-khadem wants to merge 2 commits into
cmus:masterfrom
erfan-khadem:master
Closed

erfan-khadem wants to merge 2 commits into
cmus:masterfrom
erfan-khadem:master

Conversation

@erfan-khadem

@erfan-khadem erfan-khadem commented Feb 16, 2022 •

Copy link
Copy Markdown

I noticed that from probably PipeWire 0.3.34 up to now, cmus started taking a long time before exiting when the music is paused (#1064), otherwise it has no issue. It seems like disabling _pa_stream_drain on PipeWire when exiting cmus fixes the issue and has no apparent setbacks. This seems to be an issue with upstream (as it was once fixed there), but given the simplicity of the workaround, we can have this until upstream fixes the issue.

@erfan-khadem erfan-khadem changed the title Workaround for #1126 Workaround for #1064 Feb 16, 2022

@gavtroy gavtroy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, since it's not obvious what purpose _pa_stream_drain() serves in the first place I wouldn't object to adding this workaround.

Comment thread op/pulse.c Outdated
if (is_pipewire) {
return OP_ERROR_SUCCESS;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this could be removed as you also guard calling the function.

Comment thread op/pulse.c Resolved
@erfan-khadem

erfan-khadem commented Jun 26, 2022 •

Copy link
Copy Markdown
Author

Thanks for you review @gavtroy. I'm really busy until Thursday. I will most certainly fix all of the issues you mentioned by the end of the week though.

Update:
I managed to squeeze this in.

@philippemilink

Copy link
Copy Markdown
Contributor

This patch works fine and I pushed it in the Debian cmus package.

Comment thread op/pulse.c
if (i) {
if (strstr(i->server_name, "PipeWire") != NULL) {
// server is PipeWire
d_print("Pulseaudio server is pipewire. Disabling _pa_stream_drain()\n");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any upstream issue we can reference here, so that we know when we can drop the workaround?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi. I really can't investigate this issue right now. I live in Iran and ... nothing good is going on right now. A few weeks ago the police was in our university (Sharif University of Technology. Go look at its wikipedia page) shooting students and beating faculty members (yeah our own professors) and arresting people and ... I just need some time to deal with this shit.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

take care :(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hope all is well.

I don't think there is an existing upstream report other than the original pipewire/-/issues/946, but the change that broke it again (pipewire/-/commit/b9c8f0f6b9) says it's expected behavior:

A corked stream should not complete a pending drain operation

I experimented with uncorking the stream first and it also solves the issue, but just removing the call makes more sense to me. It doesn't seem like we ever had any reason to wait for the stream to drain in the first place.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been working on a pipewire op (it's mostly done, but I need to rework the op api to allow for pull-based output plugins to prevent it from being unnecessarily complex and inefficient) and an aaudio one, and I think removing the drain makes sense too.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, let's go with #1268?

flyingmutant added a commit that referenced this pull request Jul 15, 2023
flyingmutant added a commit that referenced this pull request Jul 15, 2023
@pgaskin pgaskin closed this Jul 15, 2023
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.

6 participants