[pulseaudio-discuss] [PATCH] switch-on-port-available: Switch from HDMI to analog; but not the other way around

Alexander E. Patrakov patrakov at gmail.com
Fri Jan 29 23:07:50 PST 2016

30.01.2016 00:33, David Henningsson wrote:
> If you have headphones plugged in and plug in HDMI; you want sound
> to stay on headphones.
> If you have HDMI plugged in and you plug in headphones; you want sound
> to switch to headphones.
> Hence we need to take priority into account as well when determining
> whether to switch to a new profile or not.

> -        if (sink->active_port->available != PA_AVAILABLE_NO)
> +        if ((sink->active_port->available != PA_AVAILABLE_NO) && (sink->active_port->priority >= prio))

You are comparing profile priority and port priority here. Profile 
priority might include contributions from other ports (inputs or maybe 
other outputs) and thus (theoretically) prevent switching in some valid 
cases. In practice, for ALSA cards and "official" profiles (none of 
which produce multiple outputs), this doesn't matter.

So, if you want this in, please test this patch with a manually 
output:analog-stereo+output:iec958-stereo+input:analog-stereo profile 
and maybe some other artificial profile. I'd rather not do this for you, 
because this test involves stating what the correct behavior would be, 
and you are in a better position for such statements.

Alternatively, if nobody among developers tests profiles with two output 
paths on a regular basis, it may be a good idea to drop them, in which 
case the patch gets an ACK from me.

Alexander E. Patrakov

More information about the pulseaudio-discuss mailing list