[pulseaudio-discuss] [RFCv2 13/17] bluetooth: Only call *Acquire() if using BlueZ' Media API

jprvita at gmail.com jprvita at gmail.com
Mon Apr 15 14:53:28 PDT 2013


From: João Paulo Rechi Vita <jprvita at openbossa.org>

When the transport backend is oFono the stream file descriptor is passed
through the NewConnection() method call. Additionally, set the kernel
default SCO MTU value for block size (since this information is not
available) and the transport codec, which also comes in the
NewConnection() method call.
---
 src/modules/bluetooth/bluetooth-util.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index ae98029..d72137b 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -1854,6 +1854,26 @@ int pa_bluetooth_transport_acquire(pa_bluetooth_transport *t, bool optional, siz
     } else {
         pa_assert(t->device->discovery->version == BLUEZ_VERSION_5);
 
+        if (t->profile == PROFILE_HFGW) {
+            struct handsfree_card *hf_card = pa_hashmap_get(t->device->discovery->hf_cards, t->path);
+
+            /* The correct block size should take into account the SCO MTU from
+             * the Bluetooth adapter and (for adapters in the USB bus) the MxPS
+             * value from the Isoc USB endpoint in use by btusb and should be
+             * made available to userspace by the Bluetooth kernel subsystem.
+             * The empiric value will be used meanwhile. */
+            if (imtu)
+                *imtu = 48;
+            if (omtu)
+                *omtu = 48;
+
+            if (hf_card) {
+                t->codec = hf_card->codec;
+                return hf_card->fd;
+            } else
+                return -1;
+        }
+
         method = optional ? "TryAcquire" : "Acquire";
         pa_assert_se(m = dbus_message_new_method_call(t->owner, t->path, "org.bluez.MediaTransport1", method));
     }
-- 
1.7.11.7



More information about the pulseaudio-discuss mailing list