From 535ff08864b82637cff34e1d87d909d95d58753f Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Wed, 3 Feb 2021 17:34:12 +0100 Subject: [PATCH] avdtp: emit stream release for active stream if signaling is closed first, e.g. caused by hci disconnect --- CHANGELOG.md | 3 +++ src/classic/avdtp.c | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a76a2d76..b9178be36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## Unreleased ### Added + ### Fixed +AVDTP: emit stream release for active stream if signaling is closed first, e.g. caused by hci disconnect + ### Changed diff --git a/src/classic/avdtp.c b/src/classic/avdtp.c index 1c273a051..e710f017d 100644 --- a/src/classic/avdtp.c +++ b/src/classic/avdtp.c @@ -971,11 +971,15 @@ void avdtp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet } if (connection){ - btstack_linked_list_iterator_t it; + // closing signaling channel invalidates all other channels as well + btstack_linked_list_iterator_t it; btstack_linked_list_iterator_init(&it, avdtp_get_stream_endpoints()); while (btstack_linked_list_iterator_has_next(&it)){ stream_endpoint = (avdtp_stream_endpoint_t *)btstack_linked_list_iterator_next(&it); if (stream_endpoint->connection == connection){ + avdtp_handle_close_recovery_channel(stream_endpoint); + avdtp_handle_close_reporting_channel(stream_endpoint); + avdtp_handle_close_media_channel(stream_endpoint); avdtp_reset_stream_endpoint(stream_endpoint); } }