linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC BlueZ 1/3] audio/a2dp: connect A2DP vendor codec if possible
@ 2015-05-06 15:10 chanyeol.park
  2015-05-06 15:10 ` [RFC BlueZ 2/3] audio/a2dp: Fix SEP selection chanyeol.park
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: chanyeol.park @ 2015-05-06 15:10 UTC (permalink / raw)
  To: linux-bluetooth

From: Chan-yeol Park <chanyeol.park@samsung.com>

This patch gives the priority on vendor codec during A2DP codec
negotiation.
---
 profiles/audio/a2dp.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index 31c5086..d9a2f72 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -1751,6 +1751,8 @@ static gboolean check_vendor_codec(struct a2dp_sep *sep, uint8_t *cap,
 static struct a2dp_sep *a2dp_find_sep(struct avdtp *session, GSList *list,
 					const char *sender)
 {
+	struct a2dp_sep *selected_sep = NULL;
+
 	for (; list; list = list->next) {
 		struct a2dp_sep *sep = list->data;
 		struct avdtp_remote_sep *rsep;
@@ -1776,15 +1778,20 @@ static struct a2dp_sep *a2dp_find_sep(struct avdtp *session, GSList *list,
 		service = avdtp_get_codec(rsep);
 		cap = (struct avdtp_media_codec_capability *) service->data;
 
-		if (cap->media_codec_type != A2DP_CODEC_VENDOR)
-			return sep;
+		if (cap->media_codec_type != A2DP_CODEC_VENDOR) {
+			selected_sep = sep;
+			continue;
+		}
 
 		if (check_vendor_codec(sep, cap->data,
 					service->length - sizeof(*cap)))
 			return sep;
 	}
 
-	return NULL;
+	if (selected_sep)
+		return selected_sep;
+	else
+		return NULL;
 }
 
 static struct a2dp_sep *a2dp_select_sep(struct avdtp *session, uint8_t type,
-- 
2.1.0


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

end of thread, other threads:[~2015-05-26 14:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-06 15:10 [RFC BlueZ 1/3] audio/a2dp: connect A2DP vendor codec if possible chanyeol.park
2015-05-06 15:10 ` [RFC BlueZ 2/3] audio/a2dp: Fix SEP selection chanyeol.park
2015-05-06 15:10 ` [RFC BlueZ 3/3] audio/a2dp: Remove useless check_vendor_codec() chanyeol.park
2015-05-07  8:20 ` [RFC BlueZ 1/3] audio/a2dp: connect A2DP vendor codec if possible Luiz Augusto von Dentz
2015-05-26  6:28   ` Chan-yeol Park
2015-05-26 14:30     ` Luiz Augusto von Dentz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).