From 6d3263ec491c8c502d2f33782fd7ae497db4ee9d Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Mon, 8 Jul 2024 15:05:37 +0200 Subject: [PATCH] a2dp: emit stream established if peer set-up configuration --- CHANGELOG.md | 1 + src/classic/a2dp.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90ebf0add..b5b4839d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - HID Host: return complete HID report - SM: fix CTKD key distribution over BR/EDR - SM: fix CTKD after BR/EDR Role Change +- A2DP: emit stream established if peer set-up configuration ### Changed - GAP: return command disallowed if disconnect already requested diff --git a/src/classic/a2dp.c b/src/classic/a2dp.c index 757dd7c36..5dc75ed6a 100644 --- a/src/classic/a2dp.c +++ b/src/classic/a2dp.c @@ -494,6 +494,7 @@ void a2dp_config_process_avdtp_event_handler(avdtp_role_t role, uint8_t *packet, uint8_t status; uint8_t local_seid; uint8_t remote_seid; + bool outgoing_active; switch (hci_event_avdtp_meta_get_subevent_code(packet)){ case AVDTP_SUBEVENT_SIGNALING_CONNECTION_ESTABLISHED: @@ -760,14 +761,18 @@ void a2dp_config_process_avdtp_event_handler(avdtp_role_t role, uint8_t *packet, cid = avdtp_subevent_streaming_connection_established_get_avdtp_cid(packet); connection = avdtp_get_connection_for_avdtp_cid(cid); btstack_assert(connection != NULL); + config_process = a2dp_config_process_for_role(role, connection); - - if (config_process->state != A2DP_W4_OPEN_STREAM_WITH_SEID) break; - + outgoing_active = config_process->outgoing_active; config_process->outgoing_active = false; status = avdtp_subevent_streaming_connection_established_get_status(packet); if (status != ERROR_CODE_SUCCESS){ log_info("A2DP source streaming connection could not be established, avdtp_cid 0x%02x, status 0x%02x ---", cid, status); + config_process->state = A2DP_CONNECTED; + // suppress event if streaming wasn't requested by us + if (outgoing_active == false){ + break; + } } else { log_info("A2DP source streaming connection established --- avdtp_cid 0x%02x, local seid 0x%02x, remote seid 0x%02x", cid, avdtp_subevent_streaming_connection_established_get_local_seid(packet),