summaryrefslogtreecommitdiffstats
path: root/audio/a2dp.c
diff options
context:
space:
mode:
Diffstat (limited to 'audio/a2dp.c')
-rw-r--r--audio/a2dp.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/audio/a2dp.c b/audio/a2dp.c
index 7574dbbb..b8431bc6 100644
--- a/audio/a2dp.c
+++ b/audio/a2dp.c
@@ -50,6 +50,9 @@ static uint32_t source_record_id = 0;
static struct avdtp_local_sep *sink_sep = NULL;
static struct avdtp_local_sep *source_sep = NULL;
+static struct avdtp *start_session = NULL;
+static struct avdtp_stream *start_stream = NULL;
+
static gboolean setconf_ind(struct avdtp *session,
struct avdtp_local_sep *sep,
struct avdtp_stream *stream,
@@ -175,10 +178,22 @@ static gboolean open_ind(struct avdtp *session, struct avdtp_local_sep *sep,
static void open_cfm(struct avdtp *session, struct avdtp_local_sep *sep,
struct avdtp_stream *stream)
{
+ int err;
+
if (sep == sink_sep)
debug("SBC Sink: Open_Cfm");
else
debug("SBC Source: Open_Cfm");
+
+ if (session != start_session || stream != start_stream)
+ return;
+
+ start_session = NULL;
+ start_stream = NULL;
+
+ err = avdtp_start(session, stream);
+ if (err < 0)
+ error("Error on avdtp_start %s (%d)", strerror(-err), err);
}
static gboolean start_ind(struct avdtp *session, struct avdtp_local_sep *sep,
@@ -669,3 +684,11 @@ gboolean a2dp_get_config(struct avdtp_stream *stream,
return TRUE;
}
+
+void a2dp_start_stream_when_opened(struct avdtp *session,
+ struct avdtp_stream *stream)
+{
+ start_session = session;
+ start_stream = stream;
+
+}