avdtp: emit stream release for active stream if signaling is closed first, e.g. caused by hci disconnect

This commit is contained in:
Matthias Ringwald 2021-02-03 17:34:12 +01:00
parent 39a4565173
commit 535ff08864
2 changed files with 8 additions and 1 deletions

View File

@ -9,7 +9,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## Unreleased ## Unreleased
### Added ### Added
### Fixed ### Fixed
AVDTP: emit stream release for active stream if signaling is closed first, e.g. caused by hci disconnect
### Changed ### Changed

View File

@ -971,11 +971,15 @@ void avdtp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet
} }
if (connection){ 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()); btstack_linked_list_iterator_init(&it, avdtp_get_stream_endpoints());
while (btstack_linked_list_iterator_has_next(&it)){ while (btstack_linked_list_iterator_has_next(&it)){
stream_endpoint = (avdtp_stream_endpoint_t *)btstack_linked_list_iterator_next(&it); stream_endpoint = (avdtp_stream_endpoint_t *)btstack_linked_list_iterator_next(&it);
if (stream_endpoint->connection == connection){ 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); avdtp_reset_stream_endpoint(stream_endpoint);
} }
} }