pulseaudio merge requestshttps://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests2021-10-06T18:13:18Zhttps://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/643bluetooth: Add missing breaks to profile availability check2021-10-06T18:13:18ZIgor Kovalenkobluetooth: Add missing breaks to profile availability check16.0PulseAudio Marge BotPulseAudio Marge Bothttps://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/628bluetooth: Add FastStream codec2023-02-08T19:58:59ZIgor Kovalenkobluetooth: Add FastStream codecThis change adds A2DP FastStream codec with 16kHz voice backchannel.
Spec hint https://lists.freedesktop.org/archives/pulseaudio-discuss/2019-June/031175.html
Originally tested with Avantree headset and found that backchannel stream has...This change adds A2DP FastStream codec with 16kHz voice backchannel.
Spec hint https://lists.freedesktop.org/archives/pulseaudio-discuss/2019-June/031175.html
Originally tested with Avantree headset and found that backchannel stream has wrong SBC format (joint stereo not mono and 44.1kHz instead of 16kHz), but turned out this is a variant of norm at least for this device make https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/974#note_1037294
Closes #117517.0PulseAudio Marge BotPulseAudio Marge Bothttps://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/476bluetooth: a2dp dual channel SBC XQ codec configurations2021-02-25T05:20:23ZIgor Kovalenkobluetooth: a2dp dual channel SBC XQ codec configurationsThere are multiple definitions of SBC XQ, but in all cases this is SBC codec in Dual Channel mode, 8 bands, block length 16, allocation method Loudness, with bitpool adjusted to match target bitrates.
Most commonly chosen bitrates and r...There are multiple definitions of SBC XQ, but in all cases this is SBC codec in Dual Channel mode, 8 bands, block length 16, allocation method Loudness, with bitpool adjusted to match target bitrates.
Most commonly chosen bitrates and reasons are:
- 453000 - this yields most efficient packing of frames on Android for bluetooth EDR 2mbps
- 512000 - this looks to be old limit stated in bluetooth documents
- 552000 - this yields most efficient packing of frames on Android for bluetooth EDR 3mbps
Efficient packing considerations do not apply on Linux (yet?) but still we can gain from increased bitrate.
Desired SBC bitpool value is calculated from target bitrate limit; calculation could be open-coded if needed, no call to sbc library is actually required as bitrate formula is known from A2DP spec.
Issue ref #109215.0PulseAudio Marge BotPulseAudio Marge Bothttps://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/755backend-native: Fix stack corruption reading RFCOMM AT+BIA= response2022-11-27T10:39:06ZIgor Kovalenkobackend-native: Fix stack corruption reading RFCOMM AT+BIA= responseOn-stack buffer size is too short for sscanf to read `AT+BIA=` and `AT+BAC=` response strings which have variable length.
Fix this by replacing `sscanf` with proper copy of input string.
Fixes: cca0d6937 ("bluetooth: add AT+BIA support...On-stack buffer size is too short for sscanf to read `AT+BIA=` and `AT+BAC=` response strings which have variable length.
Fix this by replacing `sscanf` with proper copy of input string.
Fixes: cca0d6937 ("bluetooth: add AT+BIA support") of !631
Problem call stack:
```c
Program terminated with signal SIGABRT, Aborted.
[...]
#5 0x00007f63b9ccefe2 in __GI___fortify_fail (msg=msg@entry=0x7f63b9d4d0bd "stack smashing detected") at fortify_fail.c:26
#6 0x00007f63b9ccefc0 in __stack_chk_fail () at stack_chk_fail.c:24
#7 0x00007f63b17fb597 in hfp_rfcomm_handle (fd=24, t=0x560c901848f0, buf=0x7ffd6d6a1230 "AT+BIA=1,1,1,1,0,0\r") at ../src/modules/bluetooth/backend-native.c:814
```PulseAudio Marge BotPulseAudio Marge Bothttps://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/440Add support for bluetooth A2DP codecs and codec switching2021-09-01T18:05:37ZSanchayan Maitysanchayan@sanchayanmaity.netAdd support for bluetooth A2DP codecs and codec switching## Admin note
This MR is based on the work of someone who published their work based on the principles of free software - and the strict legal terms of the PulseAudio software base - which include the right to freely distribute, copy, a...## Admin note
This MR is based on the work of someone who published their work based on the principles of free software - and the strict legal terms of the PulseAudio software base - which include the right to freely distribute, copy, and modify. After being banned due to abusive behaviour, the author attempted to 'withdraw permission' for anyone to use their code, which is not legally valid. They have posted further personally abusive comments within this MR, which have been deleted.
Whilst the original MR contains many comments on non-technical topics - both offering personal abuse as well as conciliatory offers to 'mediate' with the submitter - any such comments on this MR will be immediately deleted. Please keep comments on this MR to technical matters only. Thankyou.
[original MR content follows]
## Original MR comment
**EDIT:** This patch series was based on the closed MR !227 but has now been updated to not include any of the patches from the author as requested.
Primary changes in comparison are
1. Refactoring out the codec switching and D-Bus `RegisterApplication` API support in separate patches.
2. Instead of tying codec switching to A2DP profiles, profile implementation is not touched at all and allows codec switching via messaging API. For this, a message handler is registered by `module-bluez5-device`.
3. Adds support for `aptX` and `LDAC` via GStreamer. `AAC` support has also been tested but will follow later as the patch adding support for the same in GStreamer upstream is under review. See [here](https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1793). Note that LDAC support here does not support Adaptive Bit Rate (ABR). This will also follow later once we add support for this upstream.
4. GStreamer plugins for `aptX`, `LDAC` and `WIP AAC` depend on the libraries `libopenaptx`, `libldac` and `fdkaac`. Also since the upstream support isn't available in a released GStreamer version yet, for now, this can only be tested in a [gst-build](https://gitlab.freedesktop.org/gstreamer/gst-build) environment. We hope the AAC support will be merged soon and LDAC and aptX via GStreamer which are already merged should be available from v1.20.
For codec switch, running one of the following from the command line, will switch the codec.
```
pacmd send-message /card/bluez_card.XX_XX_XX_XX_XX_XX/bluez switch-codec {"ldac_hq"}
pacmd send-message /card/bluez_card.XX_XX_XX_XX_XX_XX/bluez switch-codec {"ldac_mq"}
pacmd send-message /card/bluez_card.XX_XX_XX_XX_XX_XX/bluez switch-codec {"ldac_sq"}
pacmd send-message /card/bluez_card.XX_XX_XX_XX_XX_XX/bluez switch-codec {"aptx_hd"}
pacmd send-message /card/bluez_card.XX_XX_XX_XX_XX_XX/bluez switch-codec {"aptx"}
pacmd send-message /card/bluez_card.XX_XX_XX_XX_XX_XX/bluez switch-codec {"sbc"}
```
The name passed above in `{" "}` is matched against `pa_a2dp_codec->name`. Note that the match is case sensitive. A valid bluetooth devices needs to be passed in place of XX_XX_XX_XX_XX_XX, for eg. 4C_BC_98_80_01_9B.
To test the above in [gst-build](https://gitlab.freedesktop.org/gstreamer/gst-build), the following steps need to be performed. Am assuming `build` has been specified as the build directory.
1. Clone the `gst-build` repository and follow the instructions there to build GStreamer and it's modules.
2. Once the build is complete, run the following command while in `gst-build` directory.
``` bash
ninja -C build devenv
```
This sets up a kind of virtual environment where the latest GStreamer plugins will be available.
3. Considering a freshly cloned `PulseAudio` repository in `$HOME` with this branch selected or patches applied, now run the following commands.
``` bash
cd ~/pulseaudio
meson -Dbluez5-gstreamer=enabled build
ninja -C build
```
4. Once the build is complete, `cd` to the build directory.
``` bash
cd build
src/daemon/pulseaudio -n -F src/daemon/default.pa -p $PWD/src/modules/ -v
```
Note that since the GStreamer plugins themselves depend on native codecs, `libldac` and `libopenaptx` should be installed on system beforehand.15.0PulseAudio Marge BotPulseAudio Marge Bot