1
0
mirror of https://github.com/bluekitchen/btstack.git synced 2025-03-24 13:43:38 +00:00

avdtp: only use avdtp_get_stream_endpoint_for_seid

This commit is contained in:
Matthias Ringwald 2020-10-16 12:25:00 +02:00
parent d80ccd43b8
commit 3338afc0d0
4 changed files with 10 additions and 15 deletions

@ -127,7 +127,7 @@ static avdtp_connection_t * avdtp_get_connection_for_bd_addr(bd_addr_t addr){
}
avdtp_stream_endpoint_t * avdtp_get_stream_endpoint_with_seid(uint16_t seid){
avdtp_stream_endpoint_t * avdtp_get_stream_endpoint_for_seid(uint16_t seid){
btstack_linked_list_iterator_t it;
btstack_linked_list_iterator_init(&it, avdtp_get_stream_endpoints());
while (btstack_linked_list_iterator_has_next(&it)){
@ -139,10 +139,6 @@ avdtp_stream_endpoint_t * avdtp_get_stream_endpoint_with_seid(uint16_t seid){
return NULL;
}
avdtp_stream_endpoint_t * avdtp_get_stream_endpoint_for_seid(uint16_t seid){
return avdtp_get_stream_endpoint_with_seid(seid);
}
avdtp_connection_t * avdtp_get_connection_for_l2cap_signaling_cid(uint16_t l2cap_cid){
btstack_linked_list_iterator_t it;
btstack_linked_list_iterator_init(&it, &connections);
@ -827,7 +823,7 @@ void avdtp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet
decline_connection = true;
} else {
// now, we're only dealing with media connections that are created by remote side - we're acceptor here
stream_endpoint = avdtp_get_stream_endpoint_with_seid(connection->acceptor_local_seid);
stream_endpoint = avdtp_get_stream_endpoint_for_seid(connection->acceptor_local_seid);
if ((stream_endpoint == NULL) || (stream_endpoint->l2cap_media_cid != 0) ) {
decline_connection = true;
}
@ -1029,7 +1025,7 @@ uint8_t avdtp_open_stream(uint16_t avdtp_cid, uint8_t local_seid, uint8_t remote
return ERROR_CODE_COMMAND_DISALLOWED;
}
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_with_seid(local_seid);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(local_seid);
if (!stream_endpoint) {
log_error("avdtp_media_connect: no stream_endpoint with seid %d found", local_seid);
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
@ -1058,7 +1054,7 @@ uint8_t avdtp_start_stream(uint16_t avdtp_cid, uint8_t local_seid){
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
}
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_with_seid(local_seid);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(local_seid);
if (!stream_endpoint) {
log_error("avdtp_start_stream: no stream_endpoint with seid %d found", local_seid);
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
@ -1092,7 +1088,7 @@ uint8_t avdtp_stop_stream(uint16_t avdtp_cid, uint8_t local_seid){
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
}
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_with_seid(local_seid);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(local_seid);
if (!stream_endpoint) {
log_error("avdtp_stop_stream: no stream_endpoint with seid %d found", local_seid);
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
@ -1121,7 +1117,7 @@ uint8_t avdtp_abort_stream(uint16_t avdtp_cid, uint8_t local_seid){
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
}
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_with_seid(local_seid);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(local_seid);
if (!stream_endpoint) {
log_error("avdtp_abort_stream: no stream_endpoint with seid %d found", local_seid);
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
@ -1149,7 +1145,7 @@ uint8_t avdtp_suspend_stream(uint16_t avdtp_cid, uint8_t local_seid){
log_error("avdtp_suspend_stream: no connection for signaling cid 0x%02x found", avdtp_cid);
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
}
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_with_seid(local_seid);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(local_seid);
if (!stream_endpoint) {
log_error("avdtp_suspend_stream: no stream_endpoint with seid %d found", local_seid);
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;

@ -560,7 +560,6 @@ btstack_linked_list_t * avdtp_get_connections(void);
btstack_linked_list_t * avdtp_get_stream_endpoints(void);
avdtp_stream_endpoint_t * avdtp_get_stream_endpoint_for_seid(uint16_t seid);
avdtp_stream_endpoint_t * avdtp_get_stream_endpoint_with_seid(uint16_t seid);
btstack_packet_handler_t avdtp_packet_handler_for_stream_endpoint(const avdtp_stream_endpoint_t *stream_endpoint);
void avdtp_emit_sink_and_source(uint8_t * packet, uint16_t size);

@ -174,7 +174,7 @@ void avdtp_acceptor_stream_config_subsm(avdtp_connection_t *connection, uint8_t
case AVDTP_SI_RECONFIGURE:
case AVDTP_SI_DELAYREPORT:
connection->acceptor_local_seid = packet[offset++] >> 2;
stream_endpoint = avdtp_get_stream_endpoint_with_seid(connection->acceptor_local_seid);
stream_endpoint = avdtp_get_stream_endpoint_for_seid(connection->acceptor_local_seid);
if (!stream_endpoint){
log_info("cmd %d - REJECT", connection->acceptor_signaling_packet.signal_identifier);
connection->error_code = BAD_ACP_SEID;
@ -216,7 +216,7 @@ void avdtp_acceptor_stream_config_subsm(avdtp_connection_t *connection, uint8_t
}
// deal with first susspended seid
connection->acceptor_local_seid = connection->suspended_seids[0];
stream_endpoint = avdtp_get_stream_endpoint_with_seid(connection->acceptor_local_seid);
stream_endpoint = avdtp_get_stream_endpoint_for_seid(connection->acceptor_local_seid);
if (!stream_endpoint){
log_info("stream_endpoint not found, BAD_ACP_SEID");
connection->error_code = BAD_ACP_SEID;

@ -180,7 +180,7 @@ uint8_t avdtp_sink_delay_report(uint16_t avdtp_cid, uint8_t local_seid, uint16_t
return ERROR_CODE_COMMAND_DISALLOWED;
}
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_with_seid(local_seid);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(local_seid);
if (!stream_endpoint) {
log_error("delay_report: no stream_endpoint with seid %d found", local_seid);
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;