bluetooth: Make use of getsockopt() to determine MTU configurable

A recent patch changed the MTU size from the default value of 48 to the value
returned by getsockopt(). This breaks HSP for some setups. To circumvent the
problem, this patch introduces a boolean parameter "autodetect_mtu" for
module-bluetooth-discover, module-bluez5-discover and module-bluez5-device to
make this use of getsockopt() configurable.
This commit is contained in:
Georg Chini 2017-02-04 20:32:15 +01:00 committed by Tanu Kaskinen
parent ca6c3f80f5
commit 1c80af147d
5 changed files with 38 additions and 13 deletions

View file

@ -54,7 +54,8 @@ PA_MODULE_AUTHOR("João Paulo Rechi Vita");
PA_MODULE_DESCRIPTION("BlueZ 5 Bluetooth audio sink and source");
PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE("path=<device object path>");
PA_MODULE_USAGE("path=<device object path>"
"autodetect_mtu=<boolean>");
#define MAX_PLAYBACK_CATCH_UP_USEC (100 * PA_USEC_PER_MSEC)
#define FIXED_LATENCY_PLAYBACK_A2DP (25 * PA_USEC_PER_MSEC)
@ -68,6 +69,7 @@ PA_MODULE_USAGE("path=<device object path>");
static const char* const valid_modargs[] = {
"path",
"autodetect_mtu",
NULL
};
@ -2158,6 +2160,7 @@ int pa__init(pa_module* m) {
struct userdata *u;
const char *path;
pa_modargs *ma;
bool autodetect_mtu;
pa_assert(m);
@ -2187,6 +2190,14 @@ int pa__init(pa_module* m) {
goto fail_free_modargs;
}
autodetect_mtu = true;
if (pa_modargs_get_value_boolean(ma, "autodetect_mtu", &autodetect_mtu) < 0) {
pa_log("Invalid boolean value for autodetect_mtu parameter");
goto fail_free_modargs;
}
u->device->autodetect_mtu = autodetect_mtu;
pa_modargs_free(ma);
u->device_connection_changed_slot =