[pulseaudio-discuss] [PATCH 08/17] alsa: Move the port priority logic

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Mon Dec 30 05:04:43 PST 2013


---
 src/modules/alsa/alsa-mixer.c | 29 ++++++++++-------------------
 1 file changed, 10 insertions(+), 19 deletions(-)

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 5dc0d4f..4645817 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -4524,6 +4524,11 @@ static pa_device_port* device_port_alsa_init(pa_hashmap *ports, /* card ports */
             goto finish;
         }
 
+        p->priority = path->priority * 100;
+
+        if (setting)
+            p->priority += setting->priority;
+
         pa_hashmap_put(ports, p->name, p);
         pa_proplist_update(p->proplist, PA_UPDATE_REPLACE, path->proplist);
 
@@ -4565,28 +4570,14 @@ void pa_alsa_path_set_add_ports(
         return;
 
     PA_HASHMAP_FOREACH(path, ps->paths, state) {
-        if (!path->settings || !path->settings->next) {
+        if (!path->settings || !path->settings->next)
             /* If there is no or just one setting we only need a
              * single entry */
-            pa_device_port *port = device_port_alsa_init(ports, path, path->settings, cp, extra, core);
-
-            if (!port)
-                continue;
-
-            port->priority = path->priority * 100;
-
-        } else {
+            device_port_alsa_init(ports, path, path->settings, cp, extra, core);
+        else {
             pa_alsa_setting *s;
-            PA_LLIST_FOREACH(s, path->settings) {
-                pa_device_port *port;
-
-                port = device_port_alsa_init(ports, path, s, cp, extra, core);
-
-                if (!port)
-                    continue;
-
-                port->priority = path->priority * 100 + s->priority;
-            }
+            PA_LLIST_FOREACH(s, path->settings)
+                device_port_alsa_init(ports, path, s, cp, extra, core);
         }
     }
 }
-- 
1.8.3.1



More information about the pulseaudio-discuss mailing list