[pulseaudio-commits] 2 commits - src/modules

David Henningsson diwic at kemper.freedesktop.org
Tue May 21 05:49:13 PDT 2013


 src/modules/bluetooth/module-bluetooth-device.c |   22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

New commits:
commit b156325c68f1e542a57f854c5996fafd1a79d602
Author: Mikel Astiz <mikel.astiz at bmw-carit.de>
Date:   Mon May 20 11:48:33 2013 +0200

    bluetooth: Fix missing port->profile association
    
    Commit 17b3cb954b179392e80b0a46d8f2ba4693aec386 merged Bluetooth ports
    into two ports (one for input, one for output) but the association
    between ports and profiles was lost.
    
    BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=64713

diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index 47bed2f..fd6739d 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -2154,10 +2154,16 @@ static void create_card_ports(struct userdata *u, pa_hashmap *ports) {
 }
 
 /* Run from main thread */
-static pa_card_profile *create_card_profile(struct userdata *u, const char *uuid) {
+static pa_card_profile *create_card_profile(struct userdata *u, const char *uuid, pa_hashmap *ports) {
+    pa_device_port *input_port, *output_port;
     pa_card_profile *p = NULL;
     enum profile *d;
 
+    pa_assert(u->input_port_name);
+    pa_assert(u->output_port_name);
+    pa_assert_se(input_port = pa_hashmap_get(ports, u->input_port_name));
+    pa_assert_se(output_port = pa_hashmap_get(ports, u->output_port_name));
+
     if (pa_streq(uuid, A2DP_SINK_UUID)) {
         p = pa_card_profile_new("a2dp", _("High Fidelity Playback (A2DP)"), sizeof(enum profile));
         p->priority = 10;
@@ -2165,6 +2171,7 @@ static pa_card_profile *create_card_profile(struct userdata *u, const char *uuid
         p->n_sources = 0;
         p->max_sink_channels = 2;
         p->max_source_channels = 0;
+        pa_hashmap_put(output_port->profiles, p->name, p);
 
         d = PA_CARD_PROFILE_DATA(p);
         *d = PROFILE_A2DP;
@@ -2175,6 +2182,7 @@ static pa_card_profile *create_card_profile(struct userdata *u, const char *uuid
         p->n_sources = 1;
         p->max_sink_channels = 0;
         p->max_source_channels = 2;
+        pa_hashmap_put(input_port->profiles, p->name, p);
 
         d = PA_CARD_PROFILE_DATA(p);
         *d = PROFILE_A2DP_SOURCE;
@@ -2185,6 +2193,8 @@ static pa_card_profile *create_card_profile(struct userdata *u, const char *uuid
         p->n_sources = 1;
         p->max_sink_channels = 1;
         p->max_source_channels = 1;
+        pa_hashmap_put(input_port->profiles, p->name, p);
+        pa_hashmap_put(output_port->profiles, p->name, p);
 
         d = PA_CARD_PROFILE_DATA(p);
         *d = PROFILE_HSP;
@@ -2195,6 +2205,8 @@ static pa_card_profile *create_card_profile(struct userdata *u, const char *uuid
         p->n_sources = 1;
         p->max_sink_channels = 1;
         p->max_source_channels = 1;
+        pa_hashmap_put(input_port->profiles, p->name, p);
+        pa_hashmap_put(output_port->profiles, p->name, p);
 
         d = PA_CARD_PROFILE_DATA(p);
         *d = PROFILE_HFGW;
@@ -2255,7 +2267,7 @@ static int add_card(struct userdata *u) {
     create_card_ports(u, data.ports);
 
     PA_LLIST_FOREACH(uuid, device->uuids) {
-        p = create_card_profile(u, uuid->uuid);
+        p = create_card_profile(u, uuid->uuid, data.ports);
 
         if (!p)
             continue;
@@ -2362,7 +2374,7 @@ static pa_hook_result_t uuid_added_cb(pa_bluetooth_discovery *y, const struct pa
     if (data->device != u->device)
         return PA_HOOK_OK;
 
-    p = create_card_profile(u, data->uuid);
+    p = create_card_profile(u, data->uuid, u->card->ports);
 
     if (!p)
         return PA_HOOK_OK;

commit 305f8c7af1b8e98429779663464bebe15c9b4fb7
Author: Mikel Astiz <mikel.astiz at bmw-carit.de>
Date:   Mon May 20 11:48:32 2013 +0200

    bluetooth: Create ports before card profiles
    
    Both operations are currently independent and their order can therefore
    be swapped.

diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index c877df2..47bed2f 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -2252,6 +2252,8 @@ static int add_card(struct userdata *u) {
         return -1;
     }
 
+    create_card_ports(u, data.ports);
+
     PA_LLIST_FOREACH(uuid, device->uuids) {
         p = create_card_profile(u, uuid->uuid);
 
@@ -2268,8 +2270,6 @@ static int add_card(struct userdata *u) {
 
     pa_assert(!pa_hashmap_isempty(data.profiles));
 
-    create_card_ports(u, data.ports);
-
     p = pa_card_profile_new("off", _("Off"), sizeof(enum profile));
     p->available = PA_AVAILABLE_YES;
     d = PA_CARD_PROFILE_DATA(p);



More information about the pulseaudio-commits mailing list