From b60d3b4722cad74670fd8e4fd32576e79b83f42b Mon Sep 17 00:00:00 2001 From: Milanka Ringwald Date: Fri, 13 Apr 2018 17:24:01 +0200 Subject: [PATCH] a2dp source: fix api for create stream endpoint --- src/classic/a2dp_source.c | 11 ++++++----- src/classic/a2dp_source.h | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/classic/a2dp_source.c b/src/classic/a2dp_source.c index 3ebcba9f7..b07b5dda9 100644 --- a/src/classic/a2dp_source.c +++ b/src/classic/a2dp_source.c @@ -433,20 +433,21 @@ void a2dp_source_init(void){ l2cap_register_service(&packet_handler, BLUETOOTH_PROTOCOL_AVDTP, 0xffff, LEVEL_0); } -avdtp_stream_endpoint_t * a2dp_source_create_stream_endpoint(avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type, +uint8_t a2dp_source_create_stream_endpoint(avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type, uint8_t * codec_capabilities, uint16_t codec_capabilities_len, - uint8_t * media_codec_info, uint16_t media_codec_info_len){ + uint8_t * media_codec_info, uint16_t media_codec_info_len, uint8_t * local_seid){ + *local_seid = 0; avdtp_stream_endpoint_t * local_stream_endpoint = avdtp_source_create_stream_endpoint(AVDTP_SOURCE, media_type); if (!local_stream_endpoint){ - return NULL; + return BTSTACK_MEMORY_ALLOC_FAILED; } + *local_seid = avdtp_local_seid(local_stream_endpoint); avdtp_source_register_media_transport_category(avdtp_stream_endpoint_seid(local_stream_endpoint)); avdtp_source_register_media_codec_category(avdtp_stream_endpoint_seid(local_stream_endpoint), media_type, media_codec_type, codec_capabilities, codec_capabilities_len); local_stream_endpoint->remote_configuration.media_codec.media_codec_information = media_codec_info; local_stream_endpoint->remote_configuration.media_codec.media_codec_information_len = media_codec_info_len; - sc.local_stream_endpoint = local_stream_endpoint; - return local_stream_endpoint; + return ERROR_CODE_SUCCESS; } uint8_t a2dp_source_establish_stream(bd_addr_t remote_addr, uint8_t loc_seid, uint16_t * a2dp_cid){ diff --git a/src/classic/a2dp_source.h b/src/classic/a2dp_source.h index 7dcdd71ce..a36143475 100644 --- a/src/classic/a2dp_source.h +++ b/src/classic/a2dp_source.h @@ -81,9 +81,9 @@ void a2dp_source_init(void); * * @return status ERROR_CODE_SUCCESS if sucessful. */ -avdtp_stream_endpoint_t * a2dp_source_create_stream_endpoint(avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type, - uint8_t * codec_capabilities, uint16_t codec_capabilities_len, - uint8_t * codec_configuration, uint16_t codec_configuration_len); +uint8_t a2dp_source_create_stream_endpoint(avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type, + uint8_t * codec_capabilities, uint16_t codec_capabilities_len, + uint8_t * media_codec_info, uint16_t media_codec_info_len, uint8_t * local_seid); /** * @brief Register callback for the A2DP Source client. It will receive following subevents of HCI_EVENT_A2DP_META HCI event type: