[pulseaudio-commits] 2 commits - src/modules

David Henningsson diwic at kemper.freedesktop.org
Thu Apr 3 22:25:08 PDT 2014


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

New commits:
commit 06ad1b7a06f48c012a63880b985954af25b87034
Author: David Henningsson <david.henningsson at canonical.com>
Date:   Fri Mar 28 11:55:24 2014 +0100

    module-switch-on-port-available: Use port->card pointer
    
    We now have a port->card pointer, we can use it instead of iterating
    over cards to find the correct one.
    
    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 c560306..d8cb82b 100644
--- a/src/modules/module-switch-on-port-available.c
+++ b/src/modules/module-switch-on-port-available.c
@@ -153,7 +153,6 @@ static void find_sink_and_source(pa_card *card, pa_device_port *port, pa_sink **
 }
 
 static pa_hook_result_t port_available_hook_callback(pa_core *c, pa_device_port *port, void* userdata) {
-    uint32_t state;
     pa_card* card;
     pa_sink *sink;
     pa_source *source;
@@ -162,14 +161,10 @@ static pa_hook_result_t port_available_hook_callback(pa_core *c, pa_device_port
     if (port->available == PA_AVAILABLE_UNKNOWN)
         return PA_HOOK_OK;
 
-    pa_log_debug("finding port %s", port->name);
-
-    PA_IDXSET_FOREACH(card, c->cards, state)
-        if (port == pa_hashmap_get(card->ports, port->name))
-            break;
+    card = port->card;
 
     if (!card) {
-        pa_log_warn("Did not find port %s in array of cards", port->name);
+        pa_log_warn("Port %s does not have a card", port->name);
         return PA_HOOK_OK;
     }
 

commit ef4a41e8b0ef81a53769d853dbc7679b25252327
Author: David Henningsson <david.henningsson at canonical.com>
Date:   Fri Mar 28 11:59:09 2014 +0100

    module-switch-on-port-available: Don't switch profiles on uninitialized cards
    
    This could cause the HDMI port to become the default on some systems
    where analog output was available.
    
    BugLink: https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1256511
    BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=73375
    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 2c7ad17..c560306 100644
--- a/src/modules/module-switch-on-port-available.c
+++ b/src/modules/module-switch-on-port-available.c
@@ -173,6 +173,11 @@ static pa_hook_result_t port_available_hook_callback(pa_core *c, pa_device_port
         return PA_HOOK_OK;
     }
 
+    if (pa_idxset_size(card->sinks) == 0 && pa_idxset_size(card->sources) == 0)
+        /* This card is not initialized yet. We'll handle it in
+           sink_new / source_new callbacks later. */
+        return PA_HOOK_OK;
+
     find_sink_and_source(card, port, &sink, &source);
 
     is_active_profile = card->active_profile == pa_hashmap_get(port->profiles, card->active_profile->name);



More information about the pulseaudio-commits mailing list