bluez-monitor: Propagate the msbc-support global property to device

msbc-support global property can be used for all backends, or for native
backend overloaded on a per device rule.
This commit is contained in:
Frédéric Danis 2021-04-15 15:47:28 +02:00 committed by Wim Taymans
parent fa3bd6b0e1
commit 07c9dbbffa
2 changed files with 12 additions and 5 deletions

View file

@ -1,9 +1,10 @@
# Bluez monitor config file for PipeWire version @VERSION@ #
properties = {
# Enable mSBC support for ofono backend and hsphfpd backend,
# disabled by default. Be aware that mSBC is not expected to
# work on all headset + adapter combinations.
# Enable mSBC support, disabled by default. Be aware that
# mSBC is not expected to work on all headset + adapter combinations.
# This can be overloaded for a specific device and native backend
# in rules section.
#bluez5.msbc-support = false
#bluez5.sbc-xq-support = false
@ -51,7 +52,7 @@ rules = [
#]
bluez5.reconnect-profiles = [ hfp_hf hsp_hs a2dp_sink ]
# Enable mSBC support for native backend, disabled by default.
# Overload mSBC support for native backend and a specific device.
#bluez5.msbc-support = false
# LDAC encoding quality

View file

@ -395,7 +395,7 @@ static struct device *bluez5_create_device(struct impl *impl, uint32_t id,
struct spa_handle *handle;
int res;
void *iface;
const char *rules;
const char *rules, *str;
pw_log_debug("new device %u", id);
@ -421,6 +421,12 @@ static struct device *bluez5_create_device(struct impl *impl, uint32_t id,
if ((rules = pw_properties_get(impl->conf, "rules")) != NULL)
sm_media_session_match_rules(rules, strlen(rules), device->props);
/* Propagate the msbc-support global property if it exists and is not
* overloaded by a device specific one */
if ((str = pw_properties_get(impl->props, "bluez5.msbc-support")) != NULL &&
pw_properties_get(device->props, "bluez5.msbc-support") == NULL)
pw_properties_set(device->props, "bluez5.msbc-support", str);
handle = pw_context_load_spa_handle(context,
info->factory_name,
&device->props->dict);