summaryrefslogtreecommitdiff
path: root/android/a2dp.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2014-01-14 12:42:43 +0200
committerSzymon Janc <szymon.janc@tieto.com>2014-01-14 11:52:59 +0100
commita7e6f9347775292522539522c20a125a82f4dd29 (patch)
treedeacf67e926b75f8467509e608576786687ee8b5 /android/a2dp.c
parent54ed16806e723f6fcca05b6974b2e4b866bf51d4 (diff)
downloadbluez-a7e6f9347775292522539522c20a125a82f4dd29.tar.gz
audio/A2DP: Add implemention of SEP open confirmation
Diffstat (limited to 'android/a2dp.c')
-rw-r--r--android/a2dp.c56
1 files changed, 42 insertions, 14 deletions
diff --git a/android/a2dp.c b/android/a2dp.c
index afc633108..59f8bf565 100644
--- a/android/a2dp.c
+++ b/android/a2dp.c
@@ -657,6 +657,33 @@ static void setup_remove(struct a2dp_setup *setup)
setup_free(setup);
}
+static struct a2dp_setup *find_setup(uint8_t id)
+{
+ GSList *l;
+
+ for (l = setups; l; l = g_slist_next(l)) {
+ struct a2dp_setup *setup = l->data;
+
+ if (setup->endpoint->id == id)
+ return setup;
+ }
+
+ return NULL;
+}
+
+static void setup_remove_by_id(uint8_t id)
+{
+ struct a2dp_setup *setup;
+
+ setup = find_setup(id);
+ if (!setup) {
+ error("Unable to find stream setup for endpoint %u", id);
+ return;
+ }
+
+ setup_remove(setup);
+}
+
static gboolean sep_setconf_ind(struct avdtp *session,
struct avdtp_local_sep *sep,
struct avdtp_stream *stream,
@@ -711,20 +738,6 @@ static gboolean sep_setconf_ind(struct avdtp *session,
return TRUE;
}
-static struct a2dp_setup *find_setup(uint8_t id)
-{
- GSList *l;
-
- for (l = setups; l; l = g_slist_next(l)) {
- struct a2dp_setup *setup = l->data;
-
- if (setup->endpoint->id == id)
- return setup;
- }
-
- return NULL;
-}
-
static gboolean sep_open_ind(struct avdtp *session, struct avdtp_local_sep *sep,
struct avdtp_stream *stream, uint8_t *err,
void *user_data)
@@ -854,8 +867,23 @@ failed:
setup_remove(setup);
}
+static void sep_open_cfm(struct avdtp *session, struct avdtp_local_sep *sep,
+ struct avdtp_stream *stream, struct avdtp_error *err,
+ void *user_data)
+{
+ struct a2dp_endpoint *endpoint = user_data;
+
+ DBG("");
+
+ if (!err)
+ return;
+
+ setup_remove_by_id(endpoint->id);
+}
+
static struct avdtp_sep_cfm sep_cfm = {
.set_configuration = sep_setconf_cfm,
+ .open = sep_open_cfm,
};
static uint8_t register_endpoint(const uint8_t *uuid, uint8_t codec,