module-device-manager reroutes streams too eagerly
@tanuk
Submitted by Tanu Kaskinen Assigned to pul..@..op.org
Description
Whenever something changes on a stream, module-device-manager (with do_routing=true) will re-evaluate the stream's routing to react to stream role changes. module-device-manager will not reroute streams that have pa_sink_input.save_sink set, which avoids rerouting of manually routed streams most of the time.
When an application creates a new playback stream, it may set the sink for the new stream. That counts as manual routing, so device-manager should not reroute the stream as long as the requested sink stays available, but such streams don't have save_sink set, so rerouting does happen.
An example:
paplay --device=foo somefile.ogg
That will play the audio to sink "foo", which in this example is not what device-manager would prefer to use. Now let's change the volume:
pactl set-sink-input-volume 42 +5%
That volume change will trigger rerouting in device-manager, so the stream gets moved to a different sink!
We should make it possible to distinguish between all three cases:
-
manually routed streams with persistent device configuration (can be done currently by checking save_sink == true)
-
manually routed streams with ephemeral device configuration (can't be done currently, except during stream creation)
-
automatically routed streams (can be done currently by checking save_sink == false)