All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v1 0/2] Introduce option to limit A2DP channels
@ 2024-01-29 20:41 Victor Pushkarev
  2024-01-29 20:41 ` [PATCH BlueZ v1 1/2] main.conf: " Victor Pushkarev
  2024-01-29 20:41 ` [PATCH BlueZ v1 2/2] a2dp: Reject connection when the channel limit is exceeded Victor Pushkarev
  0 siblings, 2 replies; 6+ messages in thread
From: Victor Pushkarev @ 2024-01-29 20:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: VAnPushkarev, sdfw_system_team, corvinus.v

This patch adds feature to limit the number of active A2DP connections.

This may be necessary to prevent audio mixing problem when playing from
multiple sources using A2DP profile.

Victor Pushkarev (2):
  main.conf: Introduce option to limit A2DP channels
  a2dp: Reject connection when the channel limit is exceeded

 profiles/audio/a2dp.c |  8 ++++++++
 src/btd.h             |  6 ++++++
 src/main.c            | 16 ++++++++++++++++
 src/main.conf         |  5 +++++
 4 files changed, 35 insertions(+)

-- 
2.39.3 (Apple Git-145)


^ permalink raw reply	[flat|nested] 6+ messages in thread
* [PATCH BlueZ 1/2] main.conf: Introduce option to limit A2DP channels
@ 2024-11-07 22:01 Victor Pushkarev
  2024-11-08  0:09 ` bluez.test.bot
  0 siblings, 1 reply; 6+ messages in thread
From: Victor Pushkarev @ 2024-11-07 22:01 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: sdfw_system_team, corvinus.v, Victor Pushkarev

This introduces 'Channels' which can be used to
limit the number of A2DP channels.

For new option this also adds a new group A2DP to config.

---
 src/btd.h     |  6 ++++++
 src/main.c    | 15 +++++++++++++++
 src/main.conf |  5 +++++
 3 files changed, 26 insertions(+)

diff --git a/src/btd.h b/src/btd.h
index 07205aa69..c2b6a456e 100644
--- a/src/btd.h
+++ b/src/btd.h
@@ -109,6 +109,10 @@ struct btd_avrcp_opts {
 	bool		volume_category;
 };
 
+struct btd_a2dp_opts {
+	uint8_t  channels;
+};
+
 struct btd_advmon_opts {
 	uint8_t		rssi_sampling_period;
 };
@@ -152,6 +156,8 @@ struct btd_opts {
 	struct btd_avdtp_opts avdtp;
 	struct btd_avrcp_opts avrcp;
 
+	struct btd_a2dp_opts a2dp;
+
 	uint8_t		key_size;
 
 	enum jw_repairing_t jw_repairing;
diff --git a/src/main.c b/src/main.c
index 41c3271a7..2c583e611 100644
--- a/src/main.c
+++ b/src/main.c
@@ -168,6 +168,10 @@ static const char *avdtp_options[] = {
 static const char *avrcp_options[] = {
 	"VolumeWithoutTarget",
 	"VolumeCategory",
+};
+
+static const char *a2dp_options[] = {
+	"Channels",
 	NULL
 };
 
@@ -188,6 +192,7 @@ static const struct group_table {
 	{ "CSIS",	csip_options },
 	{ "AVDTP",	avdtp_options },
 	{ "AVRCP",	avrcp_options },
+	{ "A2DP",	a2dp_options },
 	{ "AdvMon",	advmon_options },
 	{ }
 };
@@ -1157,6 +1162,13 @@ static void parse_avrcp(GKeyFile *config)
 		&btd_opts.avrcp.volume_category);
 }
 
+static void parse_a2dp(GKeyFile *config)
+{
+	parse_config_u8(config, "A2DP", "Channels",
+				&btd_opts.a2dp.channels,
+				0, UINT8_MAX);
+}
+
 static void parse_advmon(GKeyFile *config)
 {
 	parse_config_u8(config, "AdvMon", "RSSISamplingPeriod",
@@ -1181,6 +1193,7 @@ static void parse_config(GKeyFile *config)
 	parse_csis(config);
 	parse_avdtp(config);
 	parse_avrcp(config);
+	parse_a2dp(config);
 	parse_advmon(config);
 }
 
@@ -1226,6 +1239,8 @@ static void init_defaults(void)
 	btd_opts.avrcp.volume_without_target = false;
 	btd_opts.avrcp.volume_category = true;
 
+	btd_opts.a2dp.channels = 0;
+
 	btd_opts.advmon.rssi_sampling_period = 0xFF;
 	btd_opts.csis.encrypt = true;
 }
diff --git a/src/main.conf b/src/main.conf
index fff13ed2f..323a2fbbe 100644
--- a/src/main.conf
+++ b/src/main.conf
@@ -316,6 +316,11 @@
 # notifications.
 #VolumeCategory = true
 
+[A2DP]
+# Maximum number of A2DP channels
+# Defaults to 0 (unlimited)
+#Channels = 0
+
 [Policy]
 #
 # The ReconnectUUIDs defines the set of remote services that should try
-- 
2.39.3 (Apple Git-146)


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-11-08  0:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-29 20:41 [PATCH BlueZ v1 0/2] Introduce option to limit A2DP channels Victor Pushkarev
2024-01-29 20:41 ` [PATCH BlueZ v1 1/2] main.conf: " Victor Pushkarev
2024-01-29 22:18   ` bluez.test.bot
2024-01-29 20:41 ` [PATCH BlueZ v1 2/2] a2dp: Reject connection when the channel limit is exceeded Victor Pushkarev
2024-01-29 21:06   ` Luiz Augusto von Dentz
  -- strict thread matches above, loose matches on Subject: below --
2024-11-07 22:01 [PATCH BlueZ 1/2] main.conf: Introduce option to limit A2DP channels Victor Pushkarev
2024-11-08  0:09 ` bluez.test.bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.