[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] bluetooth: handle HFP codec list in any order
PulseAudio Marge Bot
gitlab at gitlab.freedesktop.org
Wed Apr 14 21:35:23 UTC 2021
PulseAudio Marge Bot pushed to branch master at PulseAudio / pulseaudio
Commits:
e3fa9375 by Igor V. Kovalenko at 2021-04-14T21:30:27+00:00
bluetooth: handle HFP codec list in any order
HFP HF peer can send +BAC= list of codecs in any order and pa only expects "1,2"
Fix this by actually parsing codec list elements while looking for "2" (mSBC)
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/537>
- - - - -
1 changed file:
- src/modules/bluetooth/backend-native.c
Changes:
=====================================
src/modules/bluetooth/backend-native.c
=====================================
@@ -562,6 +562,9 @@ static bool hfp_rfcomm_handle(int fd, pa_bluetooth_transport *t, const char *buf
struct hfp_config *c = t->config;
int val;
char str[5];
+ const char *r;
+ size_t len;
+ const char *state;
/* first-time initialize selected codec to CVSD */
if (c->selected_codec == 0)
@@ -576,10 +579,17 @@ static bool hfp_rfcomm_handle(int fd, pa_bluetooth_transport *t, const char *buf
return true;
} else if (sscanf(buf, "AT+BAC=%3s", str) == 1) {
- if (strncmp(str, "1,2", 3) == 0)
- c->support_msbc = true;
- else
- c->support_msbc = false;
+ c->support_msbc = false;
+
+ state = NULL;
+
+ /* check if codec id 2 (mSBC) is in the list of supported codecs */
+ while ((r = pa_split_in_place(str, ",", &len, &state))) {
+ if (len == 1 && r[0] == '2') {
+ c->support_msbc = true;
+ break;
+ }
+ }
c->support_codec_negotiation = true;
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/e3fa93750804a5521e43bb4ed57d72efe0a2ad1f
--
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/e3fa93750804a5521e43bb4ed57d72efe0a2ad1f
You're receiving this email because of your account on gitlab.freedesktop.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20210414/279d610a/attachment-0001.htm>
More information about the pulseaudio-commits
mailing list