Diff between dbcd2d44466b35860bb335bd5c8789e7b2a858bb and c4686d50860e18abff8bdaaa77d20d1b783801ae

Changed Files

File Additions Deletions Status
android/Android.mk +1 -0 modified
android/Makefile.am +1 -0 modified
android/avdtp.c +4 -1 modified

Full Patch

diff --git a/android/Android.mk b/android/Android.mk
index 91b9562..1f2095d 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -261,6 +261,7 @@ LOCAL_SRC_FILES := \
 	bluez/btio/btio.c \
 	bluez/lib/bluetooth.c \
 	bluez/lib/hci.c \
+	bluez/src/shared/util.c \
 
 LOCAL_C_INCLUDES += \
 	$(LOCAL_PATH)/bluez \
diff --git a/android/Makefile.am b/android/Makefile.am
index 4f13c4d..f8c76b3 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -102,6 +102,7 @@ noinst_PROGRAMS += android/avdtptest
 android_avdtptest_SOURCES = android/avdtptest.c \
 				src/log.h src/log.c \
 				btio/btio.h btio/btio.c \
+				src/shared/util.h src/shared/util.c \
 				android/avdtp.h android/avdtp.c
 android_avdtptest_CFLAGS = $(AM_CFLAGS)
 android_avdtptest_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
diff --git a/android/avdtp.c b/android/avdtp.c
index 853fdf3..ce75615 100644
--- a/android/avdtp.c
+++ b/android/avdtp.c
@@ -41,10 +41,12 @@
 
 #include "lib/bluetooth.h"
 #include "src/log.h"
+#include "src/shared/util.h"
 #include "avdtp.h"
 #include "../profiles/audio/a2dp-codecs.h"
 
 #define MAX_SEID 0x3E
+static unsigned int seids;
 
 #ifndef MAX
 # define MAX(x, y) ((x) > (y) ? (x) : (y))
@@ -3357,7 +3359,7 @@ struct avdtp_local_sep *avdtp_register_sep(uint8_t type, uint8_t media_type,
 	sep = g_new0(struct avdtp_local_sep, 1);
 
 	sep->state = AVDTP_STATE_IDLE;
-	sep->info.seid = g_slist_length(lseps) + 1;
+	sep->info.seid = util_get_uid(&seids, MAX_SEID);
 	sep->info.type = type;
 	sep->info.media_type = media_type;
 	sep->codec = codec_type;
@@ -3393,6 +3395,7 @@ int avdtp_unregister_sep(struct avdtp_local_sep *sep)
 	DBG("SEP %p unregistered: type:%d codec:%d seid:%d", sep,
 			sep->info.type, sep->codec, sep->info.seid);
 
+	util_clear_uid(&seids, sep->info.seid);
 	g_free(sep);
 
 	return 0;