diff mbox series

[v2,7/9] avdtp: Add support for MSFT offload start command

Message ID 20211119094235.2432-7-kiran.k@intel.com (mailing list archive)
State Changes Requested
Headers show
Series [v2,1/9] adapter: Enable MSFT a2dp offload codec when Experimental is set | expand

Checks

Context Check Description
tedd_an/checkpatch success Checkpatch PASS
tedd_an/gitlint success Gitlint PASS

Commit Message

K, Kiran Nov. 19, 2021, 9:42 a.m. UTC
Send MSFT avdtp start command to trigger a2dp offload
streaming after sending remote AVDTP start command.
---
 profiles/audio/avdtp.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
diff mbox series

Patch

diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
index 6a56bd4507c4..72a5e9c5a82a 100644
--- a/profiles/audio/avdtp.c
+++ b/profiles/audio/avdtp.c
@@ -2907,6 +2907,24 @@  static gboolean avdtp_open_resp(struct avdtp *session, struct avdtp_stream *stre
 	return TRUE;
 }
 
+static gboolean msft_avdtp_start(struct avdtp_stream *stream)
+{
+	int sock;
+	struct bt_msft cmd;
+
+	if (!stream->io)
+		return FALSE;
+
+	sock = g_io_channel_unix_get_fd(stream->io);
+
+	cmd.sub_opcode = 0x09;
+
+	if (setsockopt(sock, SOL_BLUETOOTH, BT_MSFT, &cmd, 1))
+		return FALSE;
+
+	return TRUE;
+}
+
 static gboolean avdtp_start_resp(struct avdtp *session,
 					struct avdtp_stream *stream,
 					struct seid_rej *resp, int size)
@@ -2921,6 +2939,9 @@  static gboolean avdtp_start_resp(struct avdtp *session,
 	if (sep->state != AVDTP_STATE_STREAMING)
 		avdtp_sep_set_state(session, sep, AVDTP_STATE_STREAMING);
 
+	if (session->use_offload)
+		msft_avdtp_start(stream);
+
 	return TRUE;
 }