mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-30 15:32:41 +00:00
avdtp: media config validator is called with preview of media codec configuration event
This commit is contained in:
parent
2965b0e608
commit
c70720c670
@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||
- HFP: removed one parameter from hfp_ag/hf_activate_voice_recognition function, instead introduced hfp_ag/hf_deactivate_voice_recognition
|
||||
- HFP: event HFP_SUBEVENT_VOICE_RECOGNITION_STATUS emitted on (enhanced) voice recognition status change. Field "activated" replaced with "state". Added additional "status" field that indicates if the command was successful.
|
||||
- HFP: streamlined enhanced voice recognition function names
|
||||
- AVDTP: media config validator is called with preview of media codec configuration event
|
||||
- Run Loop: new functionality for HCI transport drivers and inter-process communication
|
||||
- *btstack_run_loop_poll_data_sources_from_irq*: used to transfer control from IRQ handler to main thread/run loop
|
||||
- *btstack_run_loop_execute_on_main_thread*: schedule code execution on main thread from other thread
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "btstack_event.h"
|
||||
#include "btstack_memory.h"
|
||||
#include "classic/avdtp.h"
|
||||
#include "classic/avdtp_util.h"
|
||||
#include "classic/avdtp_acceptor.h"
|
||||
#include "classic/avdtp_initiator.h"
|
||||
#include "classic/avdtp_util.h"
|
||||
@ -60,7 +61,7 @@ static bool l2cap_registered;
|
||||
static btstack_packet_handler_t avdtp_source_callback;
|
||||
static btstack_packet_handler_t avdtp_sink_callback;
|
||||
static btstack_context_callback_registration_t avdtp_handle_sdp_client_query_request;
|
||||
static uint8_t (*avdtp_media_config_validator)(const avdtp_stream_endpoint_t * stream_endpoint, avdtp_media_codec_type_t media_codec_type, const uint8_t * media_codec_info, uint16_t media_codec_info_len);
|
||||
static uint8_t (*avdtp_media_config_validator)(const avdtp_stream_endpoint_t * stream_endpoint, const uint8_t * event, uint16_t size);
|
||||
|
||||
static uint16_t sdp_query_context_avdtp_cid = 0;
|
||||
|
||||
@ -432,15 +433,18 @@ void avdtp_register_media_handler(void (*callback)(uint8_t local_seid, uint8_t *
|
||||
avdtp_sink_handle_media_data = callback;
|
||||
}
|
||||
|
||||
void avdtp_register_media_config_validator(uint8_t (*callback)(const avdtp_stream_endpoint_t * stream_endpoint, avdtp_media_codec_type_t media_codec_type, const uint8_t * media_codec_info, uint16_t media_codec_info_len)){
|
||||
void avdtp_register_media_config_validator(uint8_t (*callback)(const avdtp_stream_endpoint_t * stream_endpoint, const uint8_t * event, uint16_t size)){
|
||||
avdtp_media_config_validator = callback;
|
||||
}
|
||||
|
||||
uint8_t avdtp_validate_media_configuration(const avdtp_stream_endpoint_t * stream_endpoint, avdtp_media_codec_type_t media_codec_type, const uint8_t * media_codec_info, uint16_t media_codec_info_len){
|
||||
uint8_t avdtp_validate_media_configuration(const avdtp_stream_endpoint_t *stream_endpoint, uint16_t avdtp_cid,
|
||||
uint8_t reconfigure, const adtvp_media_codec_capabilities_t *media_codec) {
|
||||
if (avdtp_media_config_validator == NULL) {
|
||||
return 0;
|
||||
}
|
||||
return (*avdtp_media_config_validator)(stream_endpoint, media_codec_type, media_codec_info, media_codec_info_len);
|
||||
uint8_t event[AVDTP_MEDIA_CONFIG_OTHER_EVENT_LEN];
|
||||
uint16_t size = avdtp_setup_media_codec_config_event(event, sizeof(event), stream_endpoint, avdtp_cid, reconfigure, media_codec);
|
||||
return (*avdtp_media_config_validator)(stream_endpoint, event, size);
|
||||
}
|
||||
|
||||
/* START: tracking can send now requests per l2cap cid */
|
||||
|
@ -628,9 +628,11 @@ void avdtp_register_media_handler(void (*callback)(uint8_t local_seid, uint8_t *
|
||||
/**
|
||||
* @brief Register media configuration validator. Can reject insuitable configuration or report stream endpoint as currently busy
|
||||
* @note validator has to return AVDTP error codes like: AVDTP_ERROR_CODE_SEP_IN_USE or AVDTP_ERROR_CODE_UNSUPPORTED_CONFIGURATION
|
||||
* the callback receives the media configuration in the same format as the existing AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_SBC_CONFIGURATION
|
||||
* and similar
|
||||
* @param callback
|
||||
*/
|
||||
void avdtp_register_media_config_validator(uint8_t (*callback)(const avdtp_stream_endpoint_t * stream_endpoint, avdtp_media_codec_type_t media_codec_type, const uint8_t * media_codec_info, uint16_t media_codec_info_len));
|
||||
void avdtp_register_media_config_validator(uint8_t (*callback)(const avdtp_stream_endpoint_t * stream_endpoint, const uint8_t * event, uint16_t size));
|
||||
|
||||
void avdtp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
|
||||
avdtp_stream_endpoint_t * avdtp_create_stream_endpoint(avdtp_sep_type_t sep_type, avdtp_media_type_t media_type);
|
||||
@ -653,7 +655,8 @@ uint8_t avdtp_get_all_capabilities(uint16_t avdtp_cid, uint8_t remote_seid);
|
||||
uint8_t avdtp_get_configuration(uint16_t avdtp_cid, uint8_t remote_seid);
|
||||
uint8_t avdtp_set_configuration(uint16_t avdtp_cid, uint8_t local_seid, uint8_t remote_seid, uint16_t configured_services_bitmap, avdtp_capabilities_t configuration);
|
||||
uint8_t avdtp_reconfigure(uint16_t avdtp_cid, uint8_t local_seid, uint8_t remote_seid, uint16_t configured_services_bitmap, avdtp_capabilities_t configuration);
|
||||
uint8_t avdtp_validate_media_configuration(const avdtp_stream_endpoint_t * stream_endpoint, avdtp_media_codec_type_t media_codec_type, const uint8_t * media_codec_info, uint16_t media_codec_info_len);
|
||||
uint8_t avdtp_validate_media_configuration(const avdtp_stream_endpoint_t *stream_endpoint, uint16_t avdtp_cid,
|
||||
uint8_t reconfigure, const adtvp_media_codec_capabilities_t *media_codec);
|
||||
|
||||
// frequency will be used by avdtp_choose_sbc_sampling_frequency (if supported by both endpoints)
|
||||
void avdtp_set_preferred_sampling_frequency(avdtp_stream_endpoint_t * stream_endpoint, uint32_t sampling_frequency);
|
||||
|
@ -111,8 +111,8 @@ avdtp_acceptor_handle_configuration_command(avdtp_connection_t *connection, int
|
||||
// let application validate media configuration as well
|
||||
if (connection->error_code == 0){
|
||||
if ((sep.configured_service_categories & (1 << AVDTP_MEDIA_CODEC)) != 0){
|
||||
adtvp_media_codec_capabilities_t * media = & sep.configuration.media_codec;
|
||||
uint8_t error_code = avdtp_validate_media_configuration(stream_endpoint, media->media_codec_type, media->media_codec_information, media->media_codec_information_len);
|
||||
const adtvp_media_codec_capabilities_t * media = &sep.configuration.media_codec;
|
||||
uint8_t error_code = avdtp_validate_media_configuration(stream_endpoint, connection->avdtp_cid, 0, media);
|
||||
if (error_code != 0){
|
||||
log_info("media codec rejected by validator, error 0x%02x", error_code);
|
||||
connection->reject_service_category = AVDTP_MEDIA_CODEC;
|
||||
|
Loading…
x
Reference in New Issue
Block a user