{
struct a2dp_remote_sep *sep = data;
+ avdtp_remote_sep_set_destroy(sep->sep, NULL, NULL);
+
free(sep->path);
free(sep);
}
{ }
};
+static void remote_sep_destroy(void *user_data)
+{
+ struct a2dp_remote_sep *sep = user_data;
+
+ if (queue_remove(sep->chan->seps, sep))
+ remove_remote_sep(sep);
+}
+
static void register_remote_sep(void *data, void *user_data)
{
struct avdtp_remote_sep *rsep = data;
DBG("Found remote SEP: %s", sep->path);
+ avdtp_remote_sep_set_destroy(rsep, sep, remote_sep_destroy);
+
done:
queue_push_tail(chan->seps, sep);
}
uint8_t media_type;
struct avdtp_service_capability *codec;
gboolean delay_reporting;
+ bool discovered;
GSList *caps; /* of type struct avdtp_service_capability */
struct avdtp_stream *stream;
+ avdtp_remote_sep_destroy_t destroy;
+ void *user_data;
};
struct avdtp_local_sep {
stream_free(stream);
}
+static void sep_free(gpointer data)
+{
+ struct avdtp_remote_sep *sep = data;
+
+ if (sep->destroy)
+ sep->destroy(sep->user_data);
+
+ g_slist_free_full(sep->caps, g_free);
+ g_free(sep);
+}
+
+static void remove_disappeared(void *data, void *user_data)
+{
+ struct avdtp_remote_sep *sep = data;
+ struct avdtp *session = user_data;
+
+ if (sep->discovered)
+ return;
+
+ DBG("seid %d disappeared", sep->seid);
+
+ session->seps = g_slist_remove(session->seps, sep);
+
+ sep_free(sep);
+}
+
#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
void finalize_discovery(struct avdtp *session, int err)
#else
if (discover->id > 0)
g_source_remove(discover->id);
+ if (!err)
+ g_slist_foreach(session->seps, remove_disappeared, session);
+
if (discover->cb)
discover->cb(session, session->seps, err ? &avdtp_err : NULL,
discover->user_data);
avdtp_sep_set_state(session, sep, AVDTP_STATE_IDLE);
}
-static void sep_free(gpointer data)
-{
- struct avdtp_remote_sep *sep = data;
-
- g_slist_free_full(sep->caps, g_free);
- g_free(sep);
-}
-
static void remove_disconnect_timer(struct avdtp *session)
{
if (!session->dc_timer)
sep = find_remote_sep(session->seps, resp->seps[i].seid);
if (sep && sep->type == resp->seps[i].type &&
- sep->media_type == resp->seps[i].media_type)
+ sep->media_type == resp->seps[i].media_type &&
+ sep->codec) {
+ sep->discovered = true;
continue;
+ }
if (resp->seps[i].inuse && !stream)
continue;
sep->seid = resp->seps[i].seid;
sep->type = resp->seps[i].type;
sep->media_type = resp->seps[i].media_type;
+ sep->discovered = true;
memset(&req, 0, sizeof(req));
req.acp_seid = sep->seid;
return sep;
}
+void avdtp_remote_sep_set_destroy(struct avdtp_remote_sep *sep, void *user_data,
+ avdtp_remote_sep_destroy_t destroy)
+{
+ if (!sep)
+ return;
+
+ sep->user_data = user_data;
+ sep->destroy = destroy;
+}
+
static gboolean process_discover(gpointer data)
{
struct avdtp *session = data;