avrcp: fix issue with multiple AVCTP SDP records and where expected one is not the last

This commit is contained in:
Matthias Ringwald 2018-07-10 11:29:28 +02:00
parent b35f7fa291
commit e1ad7f0d11

View File

@ -558,14 +558,14 @@ void avrcp_handle_sdp_client_query_result(uint8_t packet_type, uint16_t channel,
break;
}
if (!sdp_query_context->parse_sdp_record){
if (!sdp_query_context->avrcp_l2cap_psm){
connection->state = AVCTP_CONNECTION_IDLE;
log_info("AVRCP: no suitable service found");
avrcp_emit_connection_established(sdp_query_context->avrcp_callback, connection->avrcp_cid, connection->remote_addr, SDP_SERVICE_NOT_FOUND);
btstack_linked_list_remove(&sdp_query_context->connections, (btstack_linked_item_t*) connection);
btstack_memory_avrcp_connection_free(connection);
break;
}
// log_info("AVRCP Control PSM 0x%02x, Browsing PSM 0x%02x", sdp_query_context->avrcp_l2cap_psm, sdp_query_context->browsing_l2cap_psm);
connection->state = AVCTP_CONNECTION_W4_L2CAP_CONNECTED;
l2cap_create_channel(sdp_query_context->packet_handler, connection->remote_addr, sdp_query_context->avrcp_l2cap_psm, l2cap_max_mtu(), NULL);
break;