mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
bluez5: disable codec switching when in A2DP sink role
Devices that expect pipewire to function as a sink don't seem to like it switching codecs. Disable codec switching when device is a source.
This commit is contained in:
parent
d617d7e1a3
commit
e0557e0ca8
1 changed files with 14 additions and 2 deletions
|
|
@ -261,11 +261,15 @@ static int set_profile(struct impl *this, uint32_t profile, const struct a2dp_co
|
||||||
this->profile = profile;
|
this->profile = profile;
|
||||||
this->selected_a2dp_codec = a2dp_codec;
|
this->selected_a2dp_codec = a2dp_codec;
|
||||||
|
|
||||||
if (profile == 1) {
|
/*
|
||||||
|
* A2DP: ensure there's a transport with the selected codec (NULL means any).
|
||||||
|
* Don't try to switch codecs when the device is in the A2DP source role, since
|
||||||
|
* devices do not appear to like that.
|
||||||
|
*/
|
||||||
|
if (profile == 1 && !(this->bt_dev->connected_profiles & SPA_BT_PROFILE_A2DP_SOURCE)) {
|
||||||
int ret;
|
int ret;
|
||||||
const struct a2dp_codec *codec_list[2], **codecs;
|
const struct a2dp_codec *codec_list[2], **codecs;
|
||||||
|
|
||||||
/* A2DP: ensure there's a transport with the selected codec (NULL means any) */
|
|
||||||
if (a2dp_codec == NULL) {
|
if (a2dp_codec == NULL) {
|
||||||
codecs = a2dp_codecs;
|
codecs = a2dp_codecs;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -464,6 +468,10 @@ static uint32_t get_profile_from_index(struct impl *this, uint32_t index, const
|
||||||
if (index < 3)
|
if (index < 3)
|
||||||
return index;
|
return index;
|
||||||
|
|
||||||
|
/* A2DP sources don't have codec profiles (device chooses it) */
|
||||||
|
if (this->bt_dev->connected_profiles & SPA_BT_PROFILE_A2DP_SOURCE)
|
||||||
|
return SPA_ID_INVALID;
|
||||||
|
|
||||||
if (index - 3 < this->supported_codec_count) {
|
if (index - 3 < this->supported_codec_count) {
|
||||||
*codec = this->supported_codecs[index - 3];
|
*codec = this->supported_codecs[index - 3];
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -482,6 +490,10 @@ static uint32_t get_index_from_profile(struct impl *this, uint32_t profile, cons
|
||||||
if (codec == NULL)
|
if (codec == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
/* A2DP sources don't have codec profiles (device chooses it) */
|
||||||
|
if (this->bt_dev->connected_profiles & SPA_BT_PROFILE_A2DP_SOURCE)
|
||||||
|
return SPA_ID_INVALID;
|
||||||
|
|
||||||
for (i = 0; i < this->supported_codec_count; ++i) {
|
for (i = 0; i < this->supported_codec_count; ++i) {
|
||||||
if (this->supported_codecs[i] == codec)
|
if (this->supported_codecs[i] == codec)
|
||||||
return 3 + i;
|
return 3 + i;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue