[pulseaudio-discuss] [RFC v2 09/18] bluetooth: Initialize codec value

Frédéric Dalleau frederic.dalleau at linux.intel.com
Thu Mar 22 09:36:33 PDT 2012


---
 src/modules/bluetooth/bluetooth-util.c          |    3 +++
 src/modules/bluetooth/module-bluetooth-device.c |    7 ++++++-
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index 1c1c7dd..a77a0d5 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -1190,6 +1190,9 @@ static DBusMessage *endpoint_set_configuration(DBusConnection *conn, DBusMessage
     t = transport_new(y, path, p, config, size);
     if (nrec)
         t->nrec = nrec;
+    if (dbus_message_has_path(m, A2DP_SOURCE_ENDPOINT_MPEG))
+        t->codec = 1;
+
     pa_hashmap_put(d->transports, t->path, t);
 
     pa_log_debug("Transport %s profile %d available", t->path, t->profile);
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index 14b196b..248460f 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -3033,7 +3033,10 @@ static int bt_transport_config_a2dp_mpeg(struct userdata *u) {
 }
 
 static int bt_transport_config_a2dp(struct userdata *u) {
-    return bt_transport_config_a2dp_mpeg(u);
+    if (u->a2dp.mode == A2DP_MODE_MPEG)
+        return bt_transport_config_a2dp_mpeg(u);
+
+    return bt_transport_config_a2dp_sbc(u);
 }
 
 static int bt_transport_config(struct userdata *u) {
@@ -3099,6 +3102,8 @@ static int setup_bt(struct userdata *u) {
     t = pa_bluetooth_device_get_transport(d, u->profile);
     if (t) {
         u->transport = pa_xstrdup(t->path);
+        u->a2dp.has_mpeg = (t->codec == 1);
+        u->a2dp.mode = (t->codec == 1) ? A2DP_MODE_MPEG : A2DP_MODE_SBC;
         return bt_transport_open(u);
     }
 
-- 
1.7.5.4



More information about the pulseaudio-discuss mailing list