! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Move streams on default output device change


Description Andre Miranda editbugs 2018-01-11 04:45:50 CET
Created attachment 7528 
Experimental patch

Currently pa-plugin allows the user to change the default output device so new streams will sink into it. Unfortunately this is not the case for existing streams, one must open pavucontrol to change each of them. This is very annoying, therefore I have prepped the attached patch to tackle this issue.

It is straightforward, the only trouble is that when pa_context_move_sink_input_by_name is called, it spawns sink, source and sink source events that call pulseaudio_volume_sink_source_check which causes the device output change again to the previous selected. I have commented the handling of those events just to demonstrate that it works. I tried some hacks such as locks and counters, but they won't work due the asynchronicity of pulseaudio's API.
Comment 1 Sean Davis editbugs 2018-01-11 15:26:46 CET
Created attachment 7529 
Tweaked Patch

I moved around some of the events and the issues previously described do not appear when switching between 4 audio outputs.
Comment 2 Andre Miranda editbugs 2018-01-12 01:27:54 CET
Unfortunately your patch doesn't fix the problem I had to workaround, two subsequent calls are made, e.g.:
Moving Sink Input: Spotify
Moving Sink Input: Spotify
Comment 3 Sean Davis editbugs 2018-02-24 15:36:35 CET
Created attachment 7614 
Tweaked Patch V2

Can you give it another shot? I've changed up my hardware config and still can't reproduce with my latest patch. Added back the missing debug output that I had stripped out before.
Comment 4 Andre Miranda editbugs 2018-02-24 19:57:11 CET
The patch works for me now, even though it's practically the same as before, guess it works now due recent commits.
Comment 5 Git Bot editbugs 2018-02-25 14:16:14 CET
Sean Davis referenced this bugreport in commit ef5822f7c71c8008223b670d399088dc7256e77a

Move streams on default output device change (Bug #14157)

Comment 6 Sean Davis editbugs 2018-02-25 14:16:41 CET
Resolved with the above commit.

Bug #14157

Reported by:
Andre Miranda
Reported on: 2018-01-11
Last modified on: 2018-02-25


CC List:
2 users



Experimental patch (2.24 KB, patch)
2018-01-11 04:45 CET , Andre Miranda
no flags
Tweaked Patch (2.81 KB, patch)
2018-01-11 15:26 CET , Sean Davis
no flags
Tweaked Patch V2 (3.13 KB, patch)
2018-02-24 15:36 CET , Sean Davis
no flags

Additional information