[pulseaudio-commits] src/modules

David Henningsson diwic at kemper.freedesktop.org
Fri Feb 26 12:46:26 UTC 2016


 src/modules/module-switch-on-port-available.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit f6e1ac2dd2af01088fb9fea85bd57502a214335b
Author: David Henningsson <david.henningsson at canonical.com>
Date:   Fri Jan 29 20:33:22 2016 +0100

    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 at canonical.com>

diff --git a/src/modules/module-switch-on-port-available.c b/src/modules/module-switch-on-port-available.c
index 5dd9786..6f4c895 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:



More information about the pulseaudio-commits mailing list