Skip to content

sink, source: copy priority from active port

The sink and source priorities are used to choose the default sink. The active port should play a part in the default device selection. If there's a sink that has a port with very high priority and a port with a very low priority, it's easy to imagine that some other sink might fall in between in priority. If the sink priorities are static like they have been so far, assigning sensible priorities to the two sinks is impossible.

I don't think there's any reason to keep sink priorities separate from the port priorities, so this patch copies the port priority to the sink.

In [1] there's a real use case where the built-in hardware of some machine has headphones and internal speakers on different PCMs, so they get separate sinks. Currently the sink priority logic doesn't have any idea whether the sink is for headphones or speakers, so the priorities get assigned badly.

I won't be surprised at all if this patch will cause some fallout: there hasn't so far been a need for comparing bluetooth and alsa port priorities to each other, so I expect them to be currently badly ordered. Similarly, sinks and sources that don't have any ports have some priority assigned to them and that priority may not be sensible compared to the port priorities. Also, with UCM we take the port priotities directly from the UCM configuration, but those values don't consider devices outside the particular hardware that the configuration was written for. I think we should ignore the priorities in the UCM configuration and instead try to figure out the device type and assign a priority based on that.

[1] !295 (merged)

Merge request reports