On Sat, 2016-01-30 at 12:07 +0500, Alexander E. Patrakov wrote: > 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. You seem to be misreading something. prio is the priority of the port being activated. -- Tanu