avdtp: remove a2dp_callback from avdtp_context_t

This commit is contained in:
Matthias Ringwald 2020-07-11 16:02:34 +02:00
parent 951d2774cf
commit 38106e952d
3 changed files with 41 additions and 39 deletions

View File

@ -59,7 +59,9 @@ static int send_stream_established_for_outgoing_connection;
static avdtp_stream_endpoint_context_t sc; static avdtp_stream_endpoint_context_t sc;
static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size); static btstack_packet_handler_t a2dp_sink_packet_handler_user;
static void a2dp_sink_packet_handler_internal(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
void a2dp_sink_create_sdp_record(uint8_t * service, uint32_t service_record_handle, uint16_t supported_features, const char * service_name, const char * service_provider_name){ void a2dp_sink_create_sdp_record(uint8_t * service, uint32_t service_record_handle, uint16_t supported_features, const char * service_name, const char * service_provider_name){
uint8_t* attribute; uint8_t* attribute;
@ -147,8 +149,8 @@ void a2dp_sink_register_packet_handler(btstack_packet_handler_t callback){
log_error("a2dp_sink_register_packet_handler called with NULL callback"); log_error("a2dp_sink_register_packet_handler called with NULL callback");
return; return;
} }
avdtp_sink_register_packet_handler(&packet_handler); avdtp_sink_register_packet_handler(&a2dp_sink_packet_handler_internal);
a2dp_sink_context.a2dp_callback = callback; a2dp_sink_packet_handler_user = callback;
} }
void a2dp_sink_register_media_handler(void (*callback)(uint8_t local_seid, uint8_t *packet, uint16_t size)){ void a2dp_sink_register_media_handler(void (*callback)(uint8_t local_seid, uint8_t *packet, uint16_t size)){
@ -258,22 +260,22 @@ static void a2dp_sink_handle_signaling_accept(uint8_t * packet){
switch (signal_identifier){ switch (signal_identifier){
case AVDTP_SI_START: case AVDTP_SI_START:
a2dp_emit_stream_event(a2dp_sink_context.a2dp_callback, cid, A2DP_SUBEVENT_STREAM_STARTED, loc_seid); a2dp_emit_stream_event(a2dp_sink_packet_handler_user, cid, A2DP_SUBEVENT_STREAM_STARTED, loc_seid);
break; break;
case AVDTP_SI_SUSPEND: case AVDTP_SI_SUSPEND:
a2dp_emit_stream_event(a2dp_sink_context.a2dp_callback, cid, A2DP_SUBEVENT_STREAM_SUSPENDED, loc_seid); a2dp_emit_stream_event(a2dp_sink_packet_handler_user, cid, A2DP_SUBEVENT_STREAM_SUSPENDED, loc_seid);
break; break;
case AVDTP_SI_ABORT: case AVDTP_SI_ABORT:
case AVDTP_SI_CLOSE: case AVDTP_SI_CLOSE:
a2dp_emit_stream_event(a2dp_sink_context.a2dp_callback, cid, A2DP_SUBEVENT_STREAM_STOPPED, loc_seid); a2dp_emit_stream_event(a2dp_sink_packet_handler_user, cid, A2DP_SUBEVENT_STREAM_STOPPED, loc_seid);
break; break;
default: default:
// a2dp_emit_cmd_accepted(a2dp_sink_context.a2dp_callback, packet, size); // a2dp_emit_cmd_accepted(a2dp_sink_packet_handler_user, packet, size);
break; break;
} }
} }
static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ static void a2dp_sink_packet_handler_internal(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
UNUSED(channel); UNUSED(channel);
UNUSED(size); UNUSED(size);
bd_addr_t address; bd_addr_t address;
@ -298,7 +300,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
send_stream_established_for_outgoing_connection = 0; send_stream_established_for_outgoing_connection = 0;
log_info("AVDTP_SUBEVENT_SIGNALING_CONNECTION failed status %d ---", status); log_info("AVDTP_SUBEVENT_SIGNALING_CONNECTION failed status %d ---", status);
a2dp_streaming_emit_connection_established(a2dp_sink_context.a2dp_callback, cid, address, 0, 0, status); a2dp_streaming_emit_connection_established(a2dp_sink_packet_handler_user, cid, address, 0, 0, status);
break; break;
} }
app_state = A2DP_CONNECTED; app_state = A2DP_CONNECTED;
@ -306,12 +308,12 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
break; break;
case AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_OTHER_CONFIGURATION: case AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_OTHER_CONFIGURATION:
avdtp_signaling_emit_media_codec_other(a2dp_sink_context.a2dp_callback, packet, size); avdtp_signaling_emit_media_codec_other(a2dp_sink_packet_handler_user, packet, size);
break; break;
case AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_SBC_CONFIGURATION: case AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_SBC_CONFIGURATION:
if (app_state < A2DP_CONNECTED) return; if (app_state < A2DP_CONNECTED) return;
a2dp_signaling_emit_media_codec_sbc(a2dp_sink_context.a2dp_callback, packet, size); a2dp_signaling_emit_media_codec_sbc(a2dp_sink_packet_handler_user, packet, size);
break; break;
case AVDTP_SUBEVENT_STREAMING_CONNECTION_ESTABLISHED: case AVDTP_SUBEVENT_STREAMING_CONNECTION_ESTABLISHED:
@ -326,11 +328,11 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
send_stream_established_for_outgoing_connection = 0; send_stream_established_for_outgoing_connection = 0;
if (status){ if (status){
a2dp_streaming_emit_connection_established(a2dp_sink_context.a2dp_callback, cid, address, loc_seid, rem_seid, status); a2dp_streaming_emit_connection_established(a2dp_sink_packet_handler_user, cid, address, loc_seid, rem_seid, status);
break; break;
} }
app_state = A2DP_STREAMING_OPENED; app_state = A2DP_STREAMING_OPENED;
a2dp_streaming_emit_connection_established(a2dp_sink_context.a2dp_callback, cid, address, loc_seid, rem_seid, 0); a2dp_streaming_emit_connection_established(a2dp_sink_packet_handler_user, cid, address, loc_seid, rem_seid, 0);
break; break;
case AVDTP_SUBEVENT_SIGNALING_ACCEPT: case AVDTP_SUBEVENT_SIGNALING_ACCEPT:
@ -341,14 +343,14 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
case AVDTP_SUBEVENT_SIGNALING_GENERAL_REJECT: case AVDTP_SUBEVENT_SIGNALING_GENERAL_REJECT:
cid = avdtp_subevent_signaling_accept_get_avdtp_cid(packet); cid = avdtp_subevent_signaling_accept_get_avdtp_cid(packet);
loc_seid = avdtp_subevent_signaling_accept_get_local_seid(packet); loc_seid = avdtp_subevent_signaling_accept_get_local_seid(packet);
a2dp_emit_cmd_rejected(a2dp_sink_context.a2dp_callback, packet, size); a2dp_emit_cmd_rejected(a2dp_sink_packet_handler_user, packet, size);
app_state = A2DP_IDLE; app_state = A2DP_IDLE;
break; break;
case AVDTP_SUBEVENT_STREAMING_CONNECTION_RELEASED: case AVDTP_SUBEVENT_STREAMING_CONNECTION_RELEASED:
cid = avdtp_subevent_streaming_connection_released_get_avdtp_cid(packet); cid = avdtp_subevent_streaming_connection_released_get_avdtp_cid(packet);
loc_seid = avdtp_subevent_streaming_connection_released_get_local_seid(packet); loc_seid = avdtp_subevent_streaming_connection_released_get_local_seid(packet);
app_state = A2DP_IDLE; app_state = A2DP_IDLE;
a2dp_emit_stream_event(a2dp_sink_context.a2dp_callback, cid, A2DP_SUBEVENT_STREAM_RELEASED, loc_seid); a2dp_emit_stream_event(a2dp_sink_packet_handler_user, cid, A2DP_SUBEVENT_STREAM_RELEASED, loc_seid);
break; break;
case AVDTP_SUBEVENT_SIGNALING_CONNECTION_RELEASED: case AVDTP_SUBEVENT_SIGNALING_CONNECTION_RELEASED:
cid = avdtp_subevent_signaling_connection_released_get_avdtp_cid(packet); cid = avdtp_subevent_signaling_connection_released_get_avdtp_cid(packet);
@ -357,11 +359,11 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
if (send_stream_established_for_outgoing_connection){ if (send_stream_established_for_outgoing_connection){
send_stream_established_for_outgoing_connection = 0; send_stream_established_for_outgoing_connection = 0;
log_info("A2DP sink outgoing connnection failed - disconnect"); log_info("A2DP sink outgoing connnection failed - disconnect");
a2dp_streaming_emit_connection_established(a2dp_sink_context.a2dp_callback, cid, address, 0, 0, ERROR_CODE_REMOTE_USER_TERMINATED_CONNECTION); a2dp_streaming_emit_connection_established(a2dp_sink_packet_handler_user, cid, address, 0, 0, ERROR_CODE_REMOTE_USER_TERMINATED_CONNECTION);
break; break;
} }
a2dp_emit_signaling_connection_released(a2dp_sink_context.a2dp_callback, cid); a2dp_emit_signaling_connection_released(a2dp_sink_packet_handler_user, cid);
app_state = A2DP_IDLE; app_state = A2DP_IDLE;
break; break;
default: default:

View File

@ -63,8 +63,9 @@ static avdtp_stream_endpoint_context_t sc;
static avdtp_sep_t remote_seps[AVDTP_MAX_SEP_NUM]; static avdtp_sep_t remote_seps[AVDTP_MAX_SEP_NUM];
static int num_remote_seps = 0; static int num_remote_seps = 0;
static btstack_timer_source_t a2dp_source_set_config_timer; static btstack_timer_source_t a2dp_source_set_config_timer;
static btstack_packet_handler_t a2dp_source_packet_handler_user;
static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size); static void a2dp_source_packet_handler_internal(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
void a2dp_source_create_sdp_record(uint8_t * service, uint32_t service_record_handle, uint16_t supported_features, const char * service_name, const char * service_provider_name){ void a2dp_source_create_sdp_record(uint8_t * service, uint32_t service_record_handle, uint16_t supported_features, const char * service_name, const char * service_provider_name){
uint8_t* attribute; uint8_t* attribute;
@ -256,7 +257,7 @@ static void a2dp_source_set_config_timer_stop(void){
btstack_run_loop_remove_timer(&a2dp_source_set_config_timer); btstack_run_loop_remove_timer(&a2dp_source_set_config_timer);
} }
static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ static void a2dp_source_packet_handler_internal(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
UNUSED(channel); UNUSED(channel);
UNUSED(size); UNUSED(size);
@ -279,7 +280,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
if (status != 0){ if (status != 0){
log_info("A2DP singnaling connection failed status %d", status); log_info("A2DP singnaling connection failed status %d", status);
app_state = A2DP_IDLE; app_state = A2DP_IDLE;
a2dp_signaling_emit_connection_established(a2dp_source_context.a2dp_callback, cid, sc.remote_addr, status); a2dp_signaling_emit_connection_established(a2dp_source_packet_handler_user, cid, sc.remote_addr, status);
break; break;
} }
log_info("A2DP singnaling connection established avdtp_cid 0x%02x", cid); log_info("A2DP singnaling connection established avdtp_cid 0x%02x", cid);
@ -302,7 +303,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
} }
// notify app // notify app
a2dp_signaling_emit_connection_established(a2dp_source_context.a2dp_callback, cid, sc.remote_addr, ERROR_CODE_SUCCESS); a2dp_signaling_emit_connection_established(a2dp_source_packet_handler_user, cid, sc.remote_addr, ERROR_CODE_SUCCESS);
break; break;
} }
@ -362,15 +363,15 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
log_info("received, but not forwarded: AVDTP_SUBEVENT_SIGNALING_MULTIPLEXING_CAPABILITY, remote seid %d", avdtp_subevent_signaling_multiplexing_capability_get_remote_seid(packet)); log_info("received, but not forwarded: AVDTP_SUBEVENT_SIGNALING_MULTIPLEXING_CAPABILITY, remote seid %d", avdtp_subevent_signaling_multiplexing_capability_get_remote_seid(packet));
break; break;
case AVDTP_SUBEVENT_SIGNALING_DELAY_REPORTING_CAPABILITY: case AVDTP_SUBEVENT_SIGNALING_DELAY_REPORTING_CAPABILITY:
a2dp_signaling_emit_delay_report_capability(a2dp_source_context.a2dp_callback, packet, size); a2dp_signaling_emit_delay_report_capability(a2dp_source_packet_handler_user, packet, size);
break; break;
case AVDTP_SUBEVENT_SIGNALING_CAPABILITIES_DONE: case AVDTP_SUBEVENT_SIGNALING_CAPABILITIES_DONE:
a2dp_signaling_emit_capabilities_done(a2dp_source_context.a2dp_callback, packet, size); a2dp_signaling_emit_capabilities_done(a2dp_source_packet_handler_user, packet, size);
break; break;
case AVDTP_SUBEVENT_SIGNALING_DELAY_REPORT: case AVDTP_SUBEVENT_SIGNALING_DELAY_REPORT:
// forward packet: // forward packet:
a2dp_signaling_emit_delay_report(a2dp_source_context.a2dp_callback, packet, size); a2dp_signaling_emit_delay_report(a2dp_source_packet_handler_user, packet, size);
break; break;
case AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_SBC_CONFIGURATION:{ case AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_SBC_CONFIGURATION:{
// TODO check cid // TODO check cid
@ -385,7 +386,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
// TODO: deal with reconfigure: avdtp_subevent_signaling_media_codec_sbc_configuration_get_reconfigure(packet); // TODO: deal with reconfigure: avdtp_subevent_signaling_media_codec_sbc_configuration_get_reconfigure(packet);
log_info("A2DP received SBC Config: sample rate %u, max bitpool %u., remote seid %d", sc.sampling_frequency, sc.max_bitpool_value, avdtp_subevent_signaling_media_codec_sbc_configuration_get_remote_seid(packet)); log_info("A2DP received SBC Config: sample rate %u, max bitpool %u., remote seid %d", sc.sampling_frequency, sc.max_bitpool_value, avdtp_subevent_signaling_media_codec_sbc_configuration_get_remote_seid(packet));
app_state = A2DP_W2_OPEN_STREAM_WITH_SEID; app_state = A2DP_W2_OPEN_STREAM_WITH_SEID;
a2dp_signaling_emit_media_codec_sbc(a2dp_source_context.a2dp_callback, packet, size); a2dp_signaling_emit_media_codec_sbc(a2dp_source_packet_handler_user, packet, size);
break; break;
} }
@ -393,7 +394,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
cid = avdtp_subevent_streaming_can_send_media_packet_now_get_avdtp_cid(packet); cid = avdtp_subevent_streaming_can_send_media_packet_now_get_avdtp_cid(packet);
local_seid = avdtp_subevent_streaming_can_send_media_packet_now_get_avdtp_cid(packet); local_seid = avdtp_subevent_streaming_can_send_media_packet_now_get_avdtp_cid(packet);
// log_info("A2DP STREAMING_CAN_SEND_MEDIA_PACKET_NOW cid 0x%02x, local_seid %d", cid, local_seid); // log_info("A2DP STREAMING_CAN_SEND_MEDIA_PACKET_NOW cid 0x%02x, local_seid %d", cid, local_seid);
a2dp_streaming_emit_can_send_media_packet_now(a2dp_source_context.a2dp_callback, cid, local_seid); a2dp_streaming_emit_can_send_media_packet_now(a2dp_source_packet_handler_user, cid, local_seid);
break; break;
case AVDTP_SUBEVENT_STREAMING_CONNECTION_ESTABLISHED: case AVDTP_SUBEVENT_STREAMING_CONNECTION_ESTABLISHED:
@ -404,12 +405,12 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
local_seid = avdtp_subevent_streaming_connection_established_get_local_seid(packet); local_seid = avdtp_subevent_streaming_connection_established_get_local_seid(packet);
if (status != 0){ if (status != 0){
log_info("A2DP streaming connection could not be established, avdtp_cid 0x%02x, status 0x%02x ---", cid, status); log_info("A2DP streaming connection could not be established, avdtp_cid 0x%02x, status 0x%02x ---", cid, status);
a2dp_streaming_emit_connection_established(a2dp_source_context.a2dp_callback, cid, address, local_seid, remote_seid, status); a2dp_streaming_emit_connection_established(a2dp_source_packet_handler_user, cid, address, local_seid, remote_seid, status);
break; break;
} }
log_info("A2DP streaming connection established --- avdtp_cid 0x%02x, local seid %d, remote seid %d", cid, local_seid, remote_seid); log_info("A2DP streaming connection established --- avdtp_cid 0x%02x, local seid %d, remote seid %d", cid, local_seid, remote_seid);
app_state = A2DP_STREAMING_OPENED; app_state = A2DP_STREAMING_OPENED;
a2dp_streaming_emit_connection_established(a2dp_source_context.a2dp_callback, cid, address, local_seid, remote_seid, 0); a2dp_streaming_emit_connection_established(a2dp_source_packet_handler_user, cid, address, local_seid, remote_seid, 0);
break; break;
case AVDTP_SUBEVENT_SIGNALING_SEP_FOUND:{ case AVDTP_SUBEVENT_SIGNALING_SEP_FOUND:{
@ -455,7 +456,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
} }
case A2DP_W2_RECONFIGURE_WITH_SEID: case A2DP_W2_RECONFIGURE_WITH_SEID:
log_info("A2DP reconfigured ... local seid %d, active remote seid %d", avdtp_stream_endpoint_seid(sc.local_stream_endpoint), sc.active_remote_sep->seid); log_info("A2DP reconfigured ... local seid %d, active remote seid %d", avdtp_stream_endpoint_seid(sc.local_stream_endpoint), sc.active_remote_sep->seid);
a2dp_signaling_emit_reconfigured(a2dp_source_context.a2dp_callback, cid, avdtp_stream_endpoint_seid(sc.local_stream_endpoint), 0); a2dp_signaling_emit_reconfigured(a2dp_source_packet_handler_user, cid, avdtp_stream_endpoint_seid(sc.local_stream_endpoint), 0);
app_state = A2DP_STREAMING_OPENED; app_state = A2DP_STREAMING_OPENED;
break; break;
case A2DP_W2_OPEN_STREAM_WITH_SEID:{ case A2DP_W2_OPEN_STREAM_WITH_SEID:{
@ -465,17 +466,17 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
break; break;
} }
case A2DP_STREAMING_OPENED: case A2DP_STREAMING_OPENED:
if (!a2dp_source_context.a2dp_callback) return; if (!a2dp_source_packet_handler_user) return;
switch (signal_identifier){ switch (signal_identifier){
case AVDTP_SI_START: case AVDTP_SI_START:
a2dp_signaling_emit_control_command(a2dp_source_context.a2dp_callback, cid, avdtp_stream_endpoint_seid(sc.local_stream_endpoint), A2DP_SUBEVENT_STREAM_STARTED); a2dp_signaling_emit_control_command(a2dp_source_packet_handler_user, cid, avdtp_stream_endpoint_seid(sc.local_stream_endpoint), A2DP_SUBEVENT_STREAM_STARTED);
break; break;
case AVDTP_SI_SUSPEND: case AVDTP_SI_SUSPEND:
a2dp_signaling_emit_control_command(a2dp_source_context.a2dp_callback, cid, avdtp_stream_endpoint_seid(sc.local_stream_endpoint), A2DP_SUBEVENT_STREAM_SUSPENDED); a2dp_signaling_emit_control_command(a2dp_source_packet_handler_user, cid, avdtp_stream_endpoint_seid(sc.local_stream_endpoint), A2DP_SUBEVENT_STREAM_SUSPENDED);
break; break;
case AVDTP_SI_ABORT: case AVDTP_SI_ABORT:
case AVDTP_SI_CLOSE: case AVDTP_SI_CLOSE:
a2dp_signaling_emit_control_command(a2dp_source_context.a2dp_callback, cid, avdtp_stream_endpoint_seid(sc.local_stream_endpoint), A2DP_SUBEVENT_STREAM_STOPPED); a2dp_signaling_emit_control_command(a2dp_source_packet_handler_user, cid, avdtp_stream_endpoint_seid(sc.local_stream_endpoint), A2DP_SUBEVENT_STREAM_STOPPED);
break; break;
default: default:
break; break;
@ -490,7 +491,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
case AVDTP_SUBEVENT_SIGNALING_REJECT: case AVDTP_SUBEVENT_SIGNALING_REJECT:
case AVDTP_SUBEVENT_SIGNALING_GENERAL_REJECT: case AVDTP_SUBEVENT_SIGNALING_GENERAL_REJECT:
app_state = A2DP_IDLE; app_state = A2DP_IDLE;
a2dp_signaling_emit_reject_cmd(a2dp_source_context.a2dp_callback, packet, size); a2dp_signaling_emit_reject_cmd(a2dp_source_packet_handler_user, packet, size);
break; break;
case AVDTP_SUBEVENT_SIGNALING_CONNECTION_RELEASED:{ case AVDTP_SUBEVENT_SIGNALING_CONNECTION_RELEASED:{
app_state = A2DP_IDLE; app_state = A2DP_IDLE;
@ -502,7 +503,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
little_endian_store_16(event, pos, avdtp_subevent_streaming_connection_released_get_avdtp_cid(packet)); little_endian_store_16(event, pos, avdtp_subevent_streaming_connection_released_get_avdtp_cid(packet));
pos += 2; pos += 2;
event[pos++] = avdtp_subevent_streaming_connection_released_get_local_seid(packet); event[pos++] = avdtp_subevent_streaming_connection_released_get_local_seid(packet);
(*a2dp_source_context.a2dp_callback)(HCI_EVENT_PACKET, 0, event, sizeof(event)); (*a2dp_source_packet_handler_user)(HCI_EVENT_PACKET, 0, event, sizeof(event));
break; break;
} }
case AVDTP_SUBEVENT_STREAMING_CONNECTION_RELEASED:{ case AVDTP_SUBEVENT_STREAMING_CONNECTION_RELEASED:{
@ -515,7 +516,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
little_endian_store_16(event, pos, avdtp_subevent_streaming_connection_released_get_avdtp_cid(packet)); little_endian_store_16(event, pos, avdtp_subevent_streaming_connection_released_get_avdtp_cid(packet));
pos += 2; pos += 2;
event[pos++] = avdtp_subevent_streaming_connection_released_get_local_seid(packet); event[pos++] = avdtp_subevent_streaming_connection_released_get_local_seid(packet);
(*a2dp_source_context.a2dp_callback)(HCI_EVENT_PACKET, 0, event, sizeof(event)); (*a2dp_source_packet_handler_user)(HCI_EVENT_PACKET, 0, event, sizeof(event));
break; break;
} }
default: default:
@ -529,8 +530,8 @@ void a2dp_source_register_packet_handler(btstack_packet_handler_t callback){
log_error("a2dp_source_register_packet_handler called with NULL callback"); log_error("a2dp_source_register_packet_handler called with NULL callback");
return; return;
} }
avdtp_source_register_packet_handler(&packet_handler); avdtp_source_register_packet_handler(&a2dp_source_packet_handler_internal);
a2dp_source_context.a2dp_callback = callback; a2dp_source_packet_handler_user = callback;
} }
void a2dp_source_init(void){ void a2dp_source_init(void){

View File

@ -544,7 +544,6 @@ typedef struct {
typedef struct { typedef struct {
btstack_packet_handler_t avdtp_callback; btstack_packet_handler_t avdtp_callback;
btstack_packet_handler_t a2dp_callback;
} avdtp_context_t; } avdtp_context_t;
extern avdtp_context_t * avdtp_source_context; extern avdtp_context_t * avdtp_source_context;