summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Henningsson <david.henningsson@canonical.com>2016-01-29 20:33:22 +0100
committerDavid Henningsson <david.henningsson@canonical.com>2016-02-26 13:45:53 +0100
commitf6e1ac2dd2af01088fb9fea85bd57502a214335b (patch)
tree69cb2e77398080a00496a66af0d99e198d4c4a13
parentfa2b0b4aad6e1aab6410b9c157a4cdf4f53e10fa (diff)
switch-on-port-available: Switch from HDMI to analog; but not the other way around
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. BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=93903 Signed-off-by: David Henningsson <david.henningsson@canonical.com>
-rw-r--r--src/modules/module-switch-on-port-available.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/modules/module-switch-on-port-available.c b/src/modules/module-switch-on-port-available.c
index 5dd978605..6f4c895bb 100644
--- a/src/modules/module-switch-on-port-available.c
+++ b/src/modules/module-switch-on-port-available.c
@@ -29,7 +29,7 @@
#include "module-switch-on-port-available-symdef.h"
-static bool profile_good_for_output(pa_card_profile *profile) {
+static bool profile_good_for_output(pa_card_profile *profile, unsigned prio) {
pa_sink *sink;
uint32_t idx;
@@ -49,7 +49,7 @@ static bool profile_good_for_output(pa_card_profile *profile) {
if (!sink->active_port)
continue;
- if (sink->active_port->available != PA_AVAILABLE_NO)
+ if ((sink->active_port->available != PA_AVAILABLE_NO) && (sink->active_port->priority >= prio))
return false;
}
@@ -88,7 +88,7 @@ static int try_to_switch_profile(pa_device_port *port) {
switch (port->direction) {
case PA_DIRECTION_OUTPUT:
name = profile->output_name;
- good = profile_good_for_output(profile);
+ good = profile_good_for_output(profile, port->priority);
break;
case PA_DIRECTION_INPUT: