mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
bluez5: don't crash on codecs without caps_preference_cmp
E.g. LDAC doesn't have that. Add the missing guard that was accidentally dropped in the rewrite. Also explicitly filter out non-A2DP/BAP codecs that can't be used in ensure_media_codec
This commit is contained in:
parent
cad0523617
commit
b91864eb37
1 changed files with 7 additions and 2 deletions
|
|
@ -4763,6 +4763,9 @@ int spa_bt_device_ensure_media_codec(struct spa_bt_device *device, const struct
|
|||
}
|
||||
|
||||
for (i = 0; codecs[i] != NULL; ++i) {
|
||||
if (codecs[i]->kind != MEDIA_CODEC_BAP && codecs[i]->kind != MEDIA_CODEC_A2DP)
|
||||
continue;
|
||||
|
||||
if (spa_bt_device_supports_media_codec(device, codecs[i], device->connected_profiles)) {
|
||||
codec = codecs[i];
|
||||
break;
|
||||
|
|
@ -4827,8 +4830,10 @@ int spa_bt_device_ensure_media_codec(struct spa_bt_device *device, const struct
|
|||
}
|
||||
|
||||
/* Sort in codec preference order */
|
||||
codec_switch_cmp_sw = sw;
|
||||
qsort(sw->paths, num_eps, sizeof(*sw->paths), codec_switch_cmp);
|
||||
if (codec->caps_preference_cmp) {
|
||||
codec_switch_cmp_sw = sw;
|
||||
qsort(sw->paths, num_eps, sizeof(*sw->paths), codec_switch_cmp);
|
||||
}
|
||||
|
||||
/* Pick at most one source and one sink endpoint, if corresponding profiles are
|
||||
* set */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue