mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-13 04:13:54 +00:00
corner case: no stream endpoints
This commit is contained in:
parent
ea80deb86f
commit
deeb51ce0e
@ -392,7 +392,7 @@ static int avdtp_acceptor_send_response_reject(uint16_t cid, avdtp_signal_identi
|
||||
return l2cap_send(cid, command, sizeof(command));
|
||||
}
|
||||
|
||||
static int avdtp_acceptor_send_response_reject_with_error_code(uint16_t cid, avdtp_signal_identifier_t identifier, uint8_t error_code, uint8_t transaction_label){
|
||||
int avdtp_acceptor_send_response_reject_with_error_code(uint16_t cid, avdtp_signal_identifier_t identifier, uint8_t error_code, uint8_t transaction_label){
|
||||
uint8_t command[3];
|
||||
command[0] = avdtp_header(transaction_label, AVDTP_SINGLE_PACKET, AVDTP_RESPONSE_REJECT_MSG);
|
||||
command[1] = (uint8_t)identifier;
|
||||
|
@ -54,6 +54,8 @@ extern "C" {
|
||||
int avdtp_acceptor_stream_config_subsm(avdtp_connection_t * connection, avdtp_stream_endpoint_t * stream_endpoint, uint8_t *packet, uint16_t size);
|
||||
int avdtp_acceptor_stream_config_subsm_run(avdtp_connection_t * connection, avdtp_stream_endpoint_t * stream_endpoint);
|
||||
|
||||
int avdtp_acceptor_send_response_reject_with_error_code(uint16_t cid, avdtp_signal_identifier_t identifier, uint8_t error_code, uint8_t transaction_label);
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -431,6 +431,10 @@ static void avdtp_sink_handle_can_send_now(avdtp_connection_t * connection, uint
|
||||
connection->acceptor_connection_state = AVDTP_SIGNALING_CONNECTION_ACCEPTOR_IDLE;
|
||||
avdtp_send_seps_response(connection->l2cap_signaling_cid, connection->acceptor_transaction_label, (avdtp_stream_endpoint_t *)&stream_endpoints);
|
||||
return;
|
||||
case AVDTP_SIGNALING_CONNECTION_ACCEPTOR_W2_REJECT_WITH_ERROR_CODE:
|
||||
connection->acceptor_connection_state = AVDTP_SIGNALING_CONNECTION_ACCEPTOR_IDLE;
|
||||
avdtp_acceptor_send_response_reject_with_error_code(connection->l2cap_signaling_cid, connection->reject_signal_identifier, connection->error_code, connection->acceptor_transaction_label);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -634,6 +638,11 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
|
||||
stream_endpoint = get_avdtp_stream_endpoint_for_l2cap_cid(channel);
|
||||
if (!stream_endpoint){
|
||||
if (!connection) break;
|
||||
connection->error_code = BAD_LENGTH;
|
||||
connection->reject_signal_identifier = connection->signaling_packet.signal_identifier;
|
||||
connection->acceptor_connection_state = AVDTP_SIGNALING_CONNECTION_ACCEPTOR_W2_REJECT_WITH_ERROR_CODE;
|
||||
avdtp_sink_request_can_send_now_self(connection, channel);
|
||||
printf("avdtp L2CAP_DATA_PACKET: no stream enpoint for local cid 0x%02x found", channel);
|
||||
break;
|
||||
}
|
||||
|
@ -60,6 +60,7 @@
|
||||
|
||||
#define NUM_CHANNELS 2
|
||||
#define SAMPLE_RATE 44100
|
||||
#define SMG_BI
|
||||
|
||||
#ifdef HAVE_PORTAUDIO
|
||||
#include <portaudio.h>
|
||||
@ -363,12 +364,13 @@ static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callbac
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef SMG_BI
|
||||
static const uint8_t media_sbc_codec_info[] = {
|
||||
0xFF, // (AVDTP_SBC_44100 << 4) | AVDTP_SBC_STEREO,
|
||||
0xFF, // (AVDTP_SBC_BLOCK_LENGTH_16 << 4) | (AVDTP_SBC_SUBBANDS_8 << 2) | AVDTP_SBC_ALLOCATION_METHOD_LOUDNESS,
|
||||
2, 53
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
int btstack_main(int argc, const char * argv[]);
|
||||
int btstack_main(int argc, const char * argv[]){
|
||||
@ -382,10 +384,11 @@ int btstack_main(int argc, const char * argv[]){
|
||||
avdtp_sink_init();
|
||||
avdtp_sink_register_packet_handler(&packet_handler);
|
||||
|
||||
#ifndef SMG_BI
|
||||
uint8_t seid = avdtp_sink_create_stream_endpoint(AVDTP_SINK, AVDTP_AUDIO);
|
||||
avdtp_sink_register_media_transport_category(seid);
|
||||
avdtp_sink_register_media_codec_category(seid, AVDTP_AUDIO, AVDTP_CODEC_SBC, media_sbc_codec_info, sizeof(media_sbc_codec_info));
|
||||
|
||||
#endif
|
||||
// uint8_t cp_type_lsb, uint8_t cp_type_msb, const uint8_t * cp_type_value, uint8_t cp_type_value_len
|
||||
// avdtp_sink_register_content_protection_category(seid, 2, 2, NULL, 0);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user