mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
bluez5: remove per-device codec filtering
This does not work as intended, because we no longer do a codec switch on device connect. It should be done in a different way, but since it's not used for anything right now, can as well remove it.
This commit is contained in:
parent
662fd8a1f9
commit
e42261c6d2
6 changed files with 10 additions and 38 deletions
|
|
@ -1121,7 +1121,6 @@ static DBusHandlerResult hsphfpd_parse_endpoint_properties(struct spa_bt_backend
|
||||||
t->n_channels = 1;
|
t->n_channels = 1;
|
||||||
t->channels[0] = SPA_AUDIO_CHANNEL_MONO;
|
t->channels[0] = SPA_AUDIO_CHANNEL_MONO;
|
||||||
|
|
||||||
t->enabled = true;
|
|
||||||
spa_bt_device_connect_profile(t->device, t->profile);
|
spa_bt_device_connect_profile(t->device, t->profile);
|
||||||
|
|
||||||
spa_log_debug(backend->log, NAME": Transport %s available for hsphfpd", endpoint->path);
|
spa_log_debug(backend->log, NAME": Transport %s available for hsphfpd", endpoint->path);
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,6 @@ static struct spa_bt_transport *_transport_create(struct rfcomm *rfcomm)
|
||||||
t->backend = backend;
|
t->backend = backend;
|
||||||
t->n_channels = 1;
|
t->n_channels = 1;
|
||||||
t->channels[0] = SPA_AUDIO_CHANNEL_MONO;
|
t->channels[0] = SPA_AUDIO_CHANNEL_MONO;
|
||||||
t->enabled = true;
|
|
||||||
|
|
||||||
spa_bt_transport_add_listener(t, &rfcomm->transport_listener, &transport_events, rfcomm);
|
spa_bt_transport_add_listener(t, &rfcomm->transport_listener, &transport_events, rfcomm);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,6 @@ static struct spa_bt_transport *_transport_create(struct spa_bt_backend *backend
|
||||||
t->codec = codec;
|
t->codec = codec;
|
||||||
t->n_channels = 1;
|
t->n_channels = 1;
|
||||||
t->channels[0] = SPA_AUDIO_CHANNEL_MONO;
|
t->channels[0] = SPA_AUDIO_CHANNEL_MONO;
|
||||||
t->enabled = true;
|
|
||||||
|
|
||||||
finish:
|
finish:
|
||||||
return t;
|
return t;
|
||||||
|
|
|
||||||
|
|
@ -188,6 +188,10 @@ static const struct a2dp_codec *a2dp_endpoint_to_codec(const char *endpoint)
|
||||||
|
|
||||||
static bool is_a2dp_codec_enabled(struct spa_bt_monitor *monitor, const struct a2dp_codec *codec)
|
static bool is_a2dp_codec_enabled(struct spa_bt_monitor *monitor, const struct a2dp_codec *codec)
|
||||||
{
|
{
|
||||||
|
if (!monitor->enable_sbc_xq && codec->feature_flag != NULL &&
|
||||||
|
strcmp(codec->feature_flag, "sbc-xq") == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
return spa_dict_lookup(&monitor->enabled_codecs, codec->name) != NULL;
|
return spa_dict_lookup(&monitor->enabled_codecs, codec->name) != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -783,27 +787,11 @@ static int device_update_props(struct spa_bt_device *device,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool device_can_accept_a2dp_codec(struct spa_bt_device *device, const struct a2dp_codec *codec)
|
|
||||||
{
|
|
||||||
struct spa_bt_monitor *monitor = device->monitor;
|
|
||||||
|
|
||||||
/* Device capability checks in addition to A2DP Capabilities. */
|
|
||||||
|
|
||||||
if (!is_a2dp_codec_enabled(device->monitor, codec))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (codec->feature_flag != NULL && strcmp(codec->feature_flag, "sbc-xq") == 0)
|
|
||||||
return monitor->enable_sbc_xq;
|
|
||||||
|
|
||||||
/* The rest is determined by A2DP caps */
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool spa_bt_device_supports_a2dp_codec(struct spa_bt_device *device, const struct a2dp_codec *codec)
|
bool spa_bt_device_supports_a2dp_codec(struct spa_bt_device *device, const struct a2dp_codec *codec)
|
||||||
{
|
{
|
||||||
struct spa_bt_remote_endpoint *ep;
|
struct spa_bt_remote_endpoint *ep;
|
||||||
|
|
||||||
if (!device_can_accept_a2dp_codec(device, codec))
|
if (!is_a2dp_codec_enabled(device->monitor, codec))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!device->adapter->application_registered) {
|
if (!device->adapter->application_registered) {
|
||||||
|
|
@ -1806,7 +1794,7 @@ int spa_bt_device_ensure_a2dp_codec(struct spa_bt_device *device, const struct a
|
||||||
*/
|
*/
|
||||||
if (spa_list_is_empty(&device->codec_switch_list) && preferred_codec != NULL) {
|
if (spa_list_is_empty(&device->codec_switch_list) && preferred_codec != NULL) {
|
||||||
spa_list_for_each(t, &device->transport_list, device_link) {
|
spa_list_for_each(t, &device->transport_list, device_link) {
|
||||||
if (t->a2dp_codec != preferred_codec || !t->enabled)
|
if (t->a2dp_codec != preferred_codec)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((device->connected_profiles & t->profile) != t->profile)
|
if ((device->connected_profiles & t->profile) != t->profile)
|
||||||
|
|
@ -1841,7 +1829,7 @@ int spa_bt_device_ensure_a2dp_codec(struct spa_bt_device *device, const struct a
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0, j = 0; i < num_codecs; ++i) {
|
for (i = 0, j = 0; i < num_codecs; ++i) {
|
||||||
if (device_can_accept_a2dp_codec(device, codecs[i])) {
|
if (is_a2dp_codec_enabled(device->monitor, codecs[i])) {
|
||||||
sw->codecs[j] = codecs[i];
|
sw->codecs[j] = codecs[i];
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
|
|
@ -1952,16 +1940,6 @@ static DBusHandlerResult endpoint_set_configuration(DBusConnection *conn,
|
||||||
spa_log_info(monitor->log, "%p: %s validate conf channels:%d",
|
spa_log_info(monitor->log, "%p: %s validate conf channels:%d",
|
||||||
monitor, path, transport->n_channels);
|
monitor, path, transport->n_channels);
|
||||||
|
|
||||||
/*
|
|
||||||
* Per-device determination of which codecs are allowed needs to be done also
|
|
||||||
* here. The A2DP codec switching process does this filtering, but before that
|
|
||||||
* BlueZ may autoconnect to any endpoint with compatible caps. In case it got it
|
|
||||||
* wrong, mark the transport disabled, and we'll switch to a better one later when
|
|
||||||
* needed. (We don't want to fail the connection, because we want to keep the
|
|
||||||
* profile connected.)
|
|
||||||
*/
|
|
||||||
transport->enabled = device_can_accept_a2dp_codec(transport->device, codec);
|
|
||||||
|
|
||||||
spa_bt_device_connect_profile(transport->device, transport->profile);
|
spa_bt_device_connect_profile(transport->device, transport->profile);
|
||||||
|
|
||||||
if ((r = dbus_message_new_method_return(m)) == NULL)
|
if ((r = dbus_message_new_method_return(m)) == NULL)
|
||||||
|
|
@ -3148,8 +3126,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
if ((res = parse_codec_array(this, info)) < 0)
|
if ((res = parse_codec_array(this, info)) < 0)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
register_media_application(this);
|
|
||||||
|
|
||||||
if (info) {
|
if (info) {
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
|
|
@ -3158,6 +3134,8 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
this->enable_sbc_xq = true;
|
this->enable_sbc_xq = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
register_media_application(this);
|
||||||
|
|
||||||
this->backend_native = backend_native_new(this, this->conn, info, support, n_support);
|
this->backend_native = backend_native_new(this, this->conn, info, support, n_support);
|
||||||
this->backend_ofono = backend_ofono_new(this, this->conn, info, support, n_support);
|
this->backend_ofono = backend_ofono_new(this, this->conn, info, support, n_support);
|
||||||
this->backend_hsphfpd = backend_hsphfpd_new(this, this->conn, info, support, n_support);
|
this->backend_hsphfpd = backend_hsphfpd_new(this, this->conn, info, support, n_support);
|
||||||
|
|
|
||||||
|
|
@ -181,8 +181,7 @@ static struct spa_bt_transport *find_transport(struct impl *this, int profile, c
|
||||||
|
|
||||||
for (i = 0; i < num_codecs; ++i) {
|
for (i = 0; i < num_codecs; ++i) {
|
||||||
spa_list_for_each(t, &device->transport_list, device_link) {
|
spa_list_for_each(t, &device->transport_list, device_link) {
|
||||||
if (t->enabled &&
|
if ((t->profile & device->connected_profiles) &&
|
||||||
(t->profile & device->connected_profiles) &&
|
|
||||||
(t->profile & profile) == t->profile &&
|
(t->profile & profile) == t->profile &&
|
||||||
(codecs[i] == NULL || t->a2dp_codec == codecs[i]))
|
(codecs[i] == NULL || t->a2dp_codec == codecs[i]))
|
||||||
return t;
|
return t;
|
||||||
|
|
|
||||||
|
|
@ -459,8 +459,6 @@ struct spa_bt_transport {
|
||||||
void *configuration;
|
void *configuration;
|
||||||
int configuration_len;
|
int configuration_len;
|
||||||
|
|
||||||
unsigned int enabled:1; /**< Transport ready for use in sink/source */
|
|
||||||
|
|
||||||
uint32_t n_channels;
|
uint32_t n_channels;
|
||||||
uint32_t channels[64];
|
uint32_t channels[64];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue