avdtp: skip stream endpoints that are currently in use, mark when selected

This commit is contained in:
Matthias Ringwald 2021-05-27 20:10:53 +02:00
parent 855fce2d38
commit 7982528c77
2 changed files with 3 additions and 0 deletions

View File

@ -413,6 +413,7 @@ static void a2dp_source_packet_handler_internal(uint8_t packet_type, uint16_t ch
configuration.min_bitpool_value = avdtp_choose_sbc_min_bitpool_value(stream_endpoint, avdtp_subevent_signaling_media_codec_sbc_capability_get_min_bitpool_value(packet));
// and pre-select this endpoint
stream_endpoint->sep.in_use = 1;
local_seid = avdtp_stream_endpoint_seid(stream_endpoint);
remote_seid = avdtp_subevent_signaling_media_codec_sbc_capability_get_remote_seid(packet);
a2dp_source_set_config_sbc(cid, local_seid, remote_seid, &configuration);

View File

@ -150,6 +150,7 @@ avdtp_stream_endpoint_t * avdtp_get_source_stream_endpoint_for_media_codec(avdtp
if (stream_endpoint->sep.type != AVDTP_SOURCE) continue;
if (stream_endpoint->sep.media_type != AVDTP_AUDIO) continue;
if (stream_endpoint->sep.capabilities.media_codec.media_codec_type != codec_type) continue;
if (stream_endpoint->sep.in_use) continue;
return stream_endpoint;
}
return NULL;
@ -162,6 +163,7 @@ avdtp_stream_endpoint_t * avdtp_get_source_stream_endpoint_for_media_codec_other
avdtp_stream_endpoint_t * stream_endpoint = (avdtp_stream_endpoint_t *)btstack_linked_list_iterator_next(&it);
if (stream_endpoint->sep.type != AVDTP_SOURCE) continue;
if (stream_endpoint->sep.media_type != AVDTP_AUDIO) continue;
if (stream_endpoint->sep.in_use) continue;
if (stream_endpoint->sep.capabilities.media_codec.media_codec_type != AVDTP_CODEC_NON_A2DP) continue;
if (stream_endpoint->sep.capabilities.media_codec.media_codec_information_len < 6) continue;
if (little_endian_read_32(stream_endpoint->sep.capabilities.media_codec.media_codec_information, 0) != vendor_id) continue;