When a port is unplugged, pa will scan all the ports and pick up the highest priorirty port and switch to that port. This will cause the issue described in #984 Let's image there are 2 sinks: hdmi sink, speaker+headphone sink. The speaker is selected as the output port. When unplugging the HDMI, we hope the speaker is still the default output port. But actually, PA will switch to the headphone if headphone's priority is higher than speaker.
This patches will check if the sink/source is the default sink/source firstly.
Signed-off-by: Libin Yang email@example.com