mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
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:
parent
ca6c3f80f5
commit
1c80af147d
5 changed files with 38 additions and 13 deletions
|
|
@ -42,6 +42,7 @@ PA_MODULE_USAGE(
|
|||
|
||||
static const char* const valid_modargs[] = {
|
||||
"headset",
|
||||
"autodetect_mtu",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
@ -51,6 +52,7 @@ struct userdata {
|
|||
pa_hashmap *loaded_device_paths;
|
||||
pa_hook_slot *device_connection_changed_slot;
|
||||
pa_bluetooth_discovery *discovery;
|
||||
bool autodetect_mtu;
|
||||
};
|
||||
|
||||
static pa_hook_result_t device_connection_changed_cb(pa_bluetooth_discovery *y, const pa_bluetooth_device *d, struct userdata *u) {
|
||||
|
|
@ -71,7 +73,7 @@ static pa_hook_result_t device_connection_changed_cb(pa_bluetooth_discovery *y,
|
|||
if (!module_loaded && pa_bluetooth_device_any_transport_connected(d)) {
|
||||
/* a new device has been connected */
|
||||
pa_module *m;
|
||||
char *args = pa_sprintf_malloc("path=%s", d->path);
|
||||
char *args = pa_sprintf_malloc("path=%s autodetect_mtu=%i", d->path, (int)u->autodetect_mtu);
|
||||
|
||||
pa_log_debug("Loading module-bluez5-device %s", args);
|
||||
m = pa_module_load(u->module->core, "module-bluez5-device", args);
|
||||
|
|
@ -101,6 +103,7 @@ int pa__init(pa_module *m) {
|
|||
pa_modargs *ma;
|
||||
const char *headset_str;
|
||||
int headset_backend;
|
||||
bool autodetect_mtu;
|
||||
|
||||
pa_assert(m);
|
||||
|
||||
|
|
@ -121,9 +124,16 @@ int pa__init(pa_module *m) {
|
|||
goto fail;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
m->userdata = u = pa_xnew0(struct userdata, 1);
|
||||
u->module = m;
|
||||
u->core = m->core;
|
||||
u->autodetect_mtu = autodetect_mtu;
|
||||
u->loaded_device_paths = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
|
||||
|
||||
if (!(u->discovery = pa_bluetooth_discovery_get(u->core, headset_backend)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue