a2dp_source: ignore set config for invalid local cid

This commit is contained in:
Matthias Ringwald 2021-05-27 17:37:31 +02:00
parent 53483b6d5b
commit 889ef44157

View File

@ -271,7 +271,9 @@ static void a2dp_handle_received_configuration(const uint8_t *packet, uint8_t lo
uint16_t cid = avdtp_subevent_signaling_media_codec_sbc_configuration_get_avdtp_cid(packet); uint16_t cid = avdtp_subevent_signaling_media_codec_sbc_configuration_get_avdtp_cid(packet);
avdtp_connection_t * avdtp_connection = avdtp_get_connection_for_avdtp_cid(cid); avdtp_connection_t * avdtp_connection = avdtp_get_connection_for_avdtp_cid(cid);
btstack_assert(avdtp_connection != NULL); btstack_assert(avdtp_connection != NULL);
avdtp_connection->a2dp_source_stream_endpoint_configured = true; local_stream_endpoint = avdtp_get_stream_endpoint_for_seid(local_seid);
// bail out if local seid invalid
if (!local_stream_endpoint) return;
// stop timer // stop timer
if (sep_discovery_cid == cid) { if (sep_discovery_cid == cid) {
@ -279,14 +281,14 @@ static void a2dp_handle_received_configuration(const uint8_t *packet, uint8_t lo
sep_discovery_cid = 0; sep_discovery_cid = 0;
} }
avdtp_connection->a2dp_source_stream_endpoint_configured = true;
// outgoing active? // outgoing active?
if (avdtp_connection->a2dp_source_state == A2DP_W4_SET_CONFIGURATION){ if (avdtp_connection->a2dp_source_state == A2DP_W4_SET_CONFIGURATION){
// outgoing: discovery and config of remote sink sep successful, trigger stream open // outgoing: discovery and config of remote sink sep successful, trigger stream open
avdtp_connection->a2dp_source_state = A2DP_W2_OPEN_STREAM_WITH_SEID; avdtp_connection->a2dp_source_state = A2DP_W2_OPEN_STREAM_WITH_SEID;
} else { } else {
// incoming: accept cid, lookup local stream endpoint and wait for stream open // incoming: wait for stream open
local_stream_endpoint = avdtp_get_stream_endpoint_for_seid(local_seid);
btstack_assert(local_stream_endpoint != NULL);
avdtp_connection->a2dp_source_state = A2DP_W4_OPEN_STREAM_WITH_SEID; avdtp_connection->a2dp_source_state = A2DP_W4_OPEN_STREAM_WITH_SEID;
} }
} }