src/modules/bluetooth/backend-native.c | 1 + src/modules/bluetooth/module-bluez5-device.c | 12 +++++++++++- src/modules/bluetooth/module-bluez5-discover.c | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-)
New commits: commit 01f489c396ac3adfb95d57be48bc9f5b5a2a76c6 Author: Arun Raghavan <[email protected]> Date: Wed Sep 13 12:49:28 2017 +0530 bluez: Don't crash on strange MTU sizes We got reports of this with automatically detected MTUs that weren't frame aligned. diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c index a37c3d54..530207a2 100644 --- a/src/modules/bluetooth/module-bluez5-device.c +++ b/src/modules/bluetooth/module-bluez5-device.c @@ -787,6 +787,16 @@ static void transport_config_mtu(struct userdata *u) { if (u->profile == PA_BLUETOOTH_PROFILE_HEADSET_HEAD_UNIT || u->profile == PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY) { u->read_block_size = u->read_link_mtu; u->write_block_size = u->write_link_mtu; + + if (!pa_frame_aligned(u->read_block_size, &u->source->sample_spec)) { + pa_log_debug("Got invalid read MTU: %lu, rounding down", u->read_block_size); + u->read_block_size = pa_frame_align(u->read_block_size, &u->source->sample_spec); + } + + if (!pa_frame_aligned(u->write_block_size, &u->sink->sample_spec)) { + pa_log_debug("Got invalid write MTU: %lu, rounding down", u->write_block_size); + u->write_block_size = pa_frame_align(u->write_block_size, &u->sink->sample_spec); + } } else { u->read_block_size = (u->read_link_mtu - sizeof(struct rtp_header) - sizeof(struct rtp_payload)) commit 9e895b172569ce5c34d977dbb7fded8c7957782e Author: Arun Raghavan <[email protected]> Date: Wed Sep 13 09:22:27 2017 +0530 bluez: Don't autodetect MTU by default This breaks a lot of headsets, so disabling by default. Can be re-enabled in configuration for specific hardware where it is deemed necessary. Also added some debug logging to be able to examine what MTU size is reported by the device. BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=102660 diff --git a/src/modules/bluetooth/backend-native.c b/src/modules/bluetooth/backend-native.c index 6eb4e168..0f0104d8 100644 --- a/src/modules/bluetooth/backend-native.c +++ b/src/modules/bluetooth/backend-native.c @@ -206,6 +206,7 @@ static int sco_acquire_cb(pa_bluetooth_transport *t, bool optional, size_t *imtu if (getsockopt(sock, SOL_SCO, SCO_OPTIONS, &sco_opt, &len) < 0) pa_log_warn("getsockopt(SCO_OPTIONS) failed, loading defaults"); else { + pa_log_debug("autodetected imtu = omtu = %u", sco_opt.mtu); if (imtu) *imtu = sco_opt.mtu; if (omtu) *omtu = sco_opt.mtu; } diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c index c0e681b1..a37c3d54 100644 --- a/src/modules/bluetooth/module-bluez5-device.c +++ b/src/modules/bluetooth/module-bluez5-device.c @@ -2256,7 +2256,7 @@ int pa__init(pa_module* m) { goto fail_free_modargs; } - autodetect_mtu = true; + autodetect_mtu = false; 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; diff --git a/src/modules/bluetooth/module-bluez5-discover.c b/src/modules/bluetooth/module-bluez5-discover.c index 97ff9435..c535ead4 100644 --- a/src/modules/bluetooth/module-bluez5-discover.c +++ b/src/modules/bluetooth/module-bluez5-discover.c @@ -124,7 +124,7 @@ int pa__init(pa_module *m) { goto fail; } - autodetect_mtu = true; + autodetect_mtu = false; if (pa_modargs_get_value_boolean(ma, "autodetect_mtu", &autodetect_mtu) < 0) { pa_log("Invalid boolean value for autodetect_mtu parameter"); goto fail; _______________________________________________ pulseaudio-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits
