diff options
author | Luiz Augusto Von Dentz <luiz.dentz-von@nokia.com> | 2010-03-24 23:30:30 +0200 |
---|---|---|
committer | Luiz Augusto Von Dentz <luiz.dentz-von@nokia.com> | 2010-03-24 23:32:24 +0200 |
commit | ab816e6549b8e2ed661bd029e274102e8e04c075 (patch) | |
tree | c5c367b6ca97552f949f6ec0a3789b1be80cc508 /audio | |
parent | f8d790861cf7e02576b4b03455748567e05f942f (diff) | |
download | bluez-ab816e6549b8e2ed661bd029e274102e8e04c075.tar.gz |
Add immediate parameter to avdtp_close
When TRUE if there is an outstanding command in the sending queue it will
cause abort which cancel any pending command.
Diffstat (limited to 'audio')
-rw-r--r-- | audio/a2dp.c | 4 | ||||
-rw-r--r-- | audio/avdtp.c | 8 | ||||
-rw-r--r-- | audio/avdtp.h | 3 | ||||
-rw-r--r-- | audio/sink.c | 6 | ||||
-rw-r--r-- | audio/source.c | 6 |
5 files changed, 16 insertions, 11 deletions
diff --git a/audio/a2dp.c b/audio/a2dp.c index c48105a2f..148898aad 100644 --- a/audio/a2dp.c +++ b/audio/a2dp.c @@ -1393,7 +1393,7 @@ unsigned int a2dp_config(struct avdtp *session, struct a2dp_sep *sep, if (l != NULL) { setup->reconfigure = TRUE; - if (avdtp_close(session, tmp->stream) < 0) { + if (avdtp_close(session, tmp->stream, FALSE) < 0) { error("avdtp_close failed"); goto failed; } @@ -1423,7 +1423,7 @@ unsigned int a2dp_config(struct avdtp *session, struct a2dp_sep *sep, g_idle_add((GSourceFunc) finalize_config, setup); } else if (!setup->reconfigure) { setup->reconfigure = TRUE; - if (avdtp_close(session, sep->stream) < 0) { + if (avdtp_close(session, sep->stream, FALSE) < 0) { error("avdtp_close failed"); goto failed; } diff --git a/audio/avdtp.c b/audio/avdtp.c index af8059a33..beacb321c 100644 --- a/audio/avdtp.c +++ b/audio/avdtp.c @@ -804,7 +804,7 @@ static gboolean stream_timeout(gpointer user_data) struct avdtp_stream *stream = user_data; struct avdtp *session = stream->session; - avdtp_close(session, stream); + avdtp_close(session, stream, FALSE); stream->idle_timer = 0; @@ -3475,7 +3475,8 @@ int avdtp_start(struct avdtp *session, struct avdtp_stream *stream) &req, sizeof(req)); } -int avdtp_close(struct avdtp *session, struct avdtp_stream *stream) +int avdtp_close(struct avdtp *session, struct avdtp_stream *stream, + gboolean immediate) { struct seid_req req; int ret; @@ -3491,6 +3492,9 @@ int avdtp_close(struct avdtp *session, struct avdtp_stream *stream) return -EINVAL; } + if (immediate && session->req && stream == session->req->stream) + return avdtp_abort(session, stream); + memset(&req, 0, sizeof(req)); req.acp_seid = stream->rseid; diff --git a/audio/avdtp.h b/audio/avdtp.h index 2e5ad5f95..3fe682b7d 100644 --- a/audio/avdtp.h +++ b/audio/avdtp.h @@ -275,7 +275,8 @@ int avdtp_reconfigure(struct avdtp *session, GSList *caps, struct avdtp_stream *stream); int avdtp_start(struct avdtp *session, struct avdtp_stream *stream); int avdtp_suspend(struct avdtp *session, struct avdtp_stream *stream); -int avdtp_close(struct avdtp *session, struct avdtp_stream *stream); +int avdtp_close(struct avdtp *session, struct avdtp_stream *stream, + gboolean immediate); int avdtp_abort(struct avdtp *session, struct avdtp_stream *stream); int avdtp_delay_report(struct avdtp *session, struct avdtp_stream *stream, uint16_t delay); diff --git a/audio/sink.c b/audio/sink.c index 3a8eb232b..4d46e5222 100644 --- a/audio/sink.c +++ b/audio/sink.c @@ -178,7 +178,7 @@ static void disconnect_cb(struct btd_device *btd_dev, gboolean removal, debug("Sink: disconnect %s", device->path); - avdtp_close(sink->session, sink->stream); + avdtp_close(sink->session, sink->stream, TRUE); } static void stream_state_changed(struct avdtp_stream *stream, @@ -634,7 +634,7 @@ static DBusMessage *sink_disconnect(DBusConnection *conn, return reply; } - err = avdtp_close(sink->session, sink->stream); + err = avdtp_close(sink->session, sink->stream, FALSE); if (err < 0) return g_dbus_create_error(msg, ERROR_INTERFACE ".Failed", "%s", strerror(-err)); @@ -836,7 +836,7 @@ gboolean sink_shutdown(struct sink *sink) if (!sink->stream) return FALSE; - if (avdtp_close(sink->session, sink->stream) < 0) + if (avdtp_close(sink->session, sink->stream, FALSE) < 0) return FALSE; return TRUE; diff --git a/audio/source.c b/audio/source.c index 1530c3414..0ea0f0096 100644 --- a/audio/source.c +++ b/audio/source.c @@ -171,7 +171,7 @@ static void disconnect_cb(struct btd_device *btd_dev, gboolean removal, debug("Source: disconnect %s", device->path); - avdtp_close(source->session, source->stream); + avdtp_close(source->session, source->stream, TRUE); } static void stream_state_changed(struct avdtp_stream *stream, @@ -596,7 +596,7 @@ static DBusMessage *source_disconnect(DBusConnection *conn, return reply; } - err = avdtp_close(source->session, source->stream); + err = avdtp_close(source->session, source->stream, FALSE); if (err < 0) return g_dbus_create_error(msg, ERROR_INTERFACE ".Failed", "%s", strerror(-err)); @@ -762,7 +762,7 @@ gboolean source_shutdown(struct source *source) if (!source->stream) return FALSE; - if (avdtp_close(source->session, source->stream) < 0) + if (avdtp_close(source->session, source->stream, FALSE) < 0) return FALSE; return TRUE; |