diff mbox series

[BlueZ,1/2] bap: Add bcast source support for MediaEndpoint Codec

Message ID 20240320144153.46408-2-silviu.barbulescu@nxp.com
State New
Headers show
Series Allow endpoint config without local endpoint argument | expand

Commit Message

Silviu Florian Barbulescu March 20, 2024, 2:41 p.m. UTC
MediaEndpoint property Codec returns 0 for the broadcast source endpoint

---
 profiles/audio/bap.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index 964ba9c21..3ab13a51e 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -277,7 +277,13 @@  static gboolean get_codec(const GDBusPropertyTable *property,
 	struct bap_ep *ep = data;
 	uint8_t codec;
 
-	bt_bap_pac_get_codec(ep->rpac, &codec, NULL, NULL);
+	/* For broadcast source, rpac is null so the codec
+	 * is retrieved from the lpac
+	 */
+	if (ep->rpac == NULL)
+		bt_bap_pac_get_codec(ep->lpac, &codec, NULL, NULL);
+	else
+		bt_bap_pac_get_codec(ep->rpac, &codec, NULL, NULL);
 
 	dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, &codec);