mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/a2dp_error_code' into 'master'
bt: Update A2DP version to v1.4 Closes BT-2918, BT-2919, and BT-2932 See merge request espressif/esp-idf!21142
This commit is contained in:
commit
1ac3595bde
@ -1914,7 +1914,7 @@ void bta_av_setconfig_rej (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data)
|
||||
|
||||
bta_av_adjust_seps_idx(p_scb, avdt_handle);
|
||||
APPL_TRACE_DEBUG("bta_av_setconfig_rej: sep_idx: %d", p_scb->sep_idx);
|
||||
AVDT_ConfigRsp(p_scb->avdt_handle, p_scb->avdt_label, AVDT_ERR_UNSUP_CFG, 0);
|
||||
AVDT_ConfigRsp(p_scb->avdt_handle, p_scb->avdt_label, p_data->ci_setconfig.err_code, 0);
|
||||
|
||||
bdcpy(reject.bd_addr, p_data->str_msg.bd_addr);
|
||||
reject.hndl = p_scb->hndl;
|
||||
|
@ -653,7 +653,7 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
|
||||
if (bta_av_cb.features & BTA_AV_FEAT_DELAY_RPT) {
|
||||
cs.cfg.psc_mask |= AVDT_PSC_DELAY_RPT;
|
||||
a2d_set_avdt_sdp_ver(AVDT_VERSION_SYNC);
|
||||
a2d_set_a2dp_sdp_ver(A2D_VERSION_SYC);
|
||||
a2d_set_a2dp_sdp_ver(A2D_VERSION_1_4);
|
||||
}
|
||||
|
||||
/* keep the configuration in the stream control block */
|
||||
|
@ -272,7 +272,7 @@ const tBTA_AG_ST_TBL bta_ag_st_tbl[] =
|
||||
/*****************************************************************************
|
||||
** Global data
|
||||
*****************************************************************************/
|
||||
const uint16_t bta_ag_version = HFP_VERSION_1_7;
|
||||
const uint16_t bta_ag_version = HFP_VERSION_1_8;
|
||||
/* AG control block */
|
||||
#if BTA_DYNAMIC_MEMORY == FALSE
|
||||
tBTA_AG_CB bta_ag_cb;
|
||||
|
@ -157,7 +157,7 @@ BOOLEAN bta_ag_add_record(UINT16 service_uuid, char *p_service_name, UINT8 scn,
|
||||
/* add profile descriptor list */
|
||||
if (service_uuid == UUID_SERVCLASS_AG_HANDSFREE) {
|
||||
profile_uuid = UUID_SERVCLASS_HF_HANDSFREE;
|
||||
version = HFP_VERSION_1_7;
|
||||
version = HFP_VERSION_1_8;
|
||||
} else {
|
||||
profile_uuid = UUID_SERVCLASS_HEADSET;
|
||||
version = HSP_VERSION_1_2;
|
||||
|
@ -49,6 +49,7 @@
|
||||
#define HFP_VERSION_1_5 0x0105
|
||||
#define HFP_VERSION_1_6 0x0106
|
||||
#define HFP_VERSION_1_7 0x0107
|
||||
#define HFP_VERSION_1_8 0x0108
|
||||
|
||||
#define HSP_VERSION_1_0 0x0100
|
||||
#define HSP_VERSION_1_2 0x0102
|
||||
|
@ -114,7 +114,7 @@ BOOLEAN bta_hf_client_add_record(char *p_service_name, UINT8 scn,
|
||||
|
||||
/* add profile descriptor list */
|
||||
profile_uuid = UUID_SERVCLASS_HF_HANDSFREE;
|
||||
version = HFP_VERSION_1_7;
|
||||
version = HFP_VERSION_1_8;
|
||||
|
||||
result &= SDP_AddProfileDescriptorList(sdp_handle, profile_uuid, version);
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#define HFP_VERSION_1_5 0x0105
|
||||
#define HFP_VERSION_1_6 0x0106
|
||||
#define HFP_VERSION_1_7 0x0107
|
||||
#define HFP_VERSION_1_8 0x0108
|
||||
|
||||
/* RFCOMM MTU SIZE */
|
||||
#define BTA_HF_CLIENT_MTU 256
|
||||
|
@ -117,8 +117,8 @@ static void bta_av_co_audio_peer_reset_config(tBTA_AV_CO_PEER *p_peer);
|
||||
static BOOLEAN bta_av_co_cp_is_scmst(const UINT8 *p_protectinfo);
|
||||
static BOOLEAN bta_av_co_audio_sink_has_scmst(const tBTA_AV_CO_SINK *p_sink);
|
||||
static BOOLEAN bta_av_co_audio_peer_supports_codec(tBTA_AV_CO_PEER *p_peer, UINT8 *p_snk_index);
|
||||
static BOOLEAN bta_av_co_audio_media_supports_config(UINT8 codec_type, const UINT8 *p_codec_cfg);
|
||||
static BOOLEAN bta_av_co_audio_sink_supports_config(UINT8 codec_type, const UINT8 *p_codec_cfg);
|
||||
static UINT8 bta_av_co_audio_media_supports_config(UINT8 codec_type, const UINT8 *p_codec_cfg);
|
||||
static UINT8 bta_av_co_audio_sink_supports_config(UINT8 codec_type, const UINT8 *p_codec_cfg);
|
||||
static BOOLEAN bta_av_co_audio_peer_src_supports_codec(tBTA_AV_CO_PEER *p_peer, UINT8 *p_src_index);
|
||||
|
||||
|
||||
@ -660,7 +660,7 @@ void bta_av_co_audio_setconfig(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
|
||||
UINT8 status = A2D_SUCCESS;
|
||||
UINT8 category = A2D_SUCCESS;
|
||||
BOOLEAN recfg_needed = FALSE;
|
||||
BOOLEAN codec_cfg_supported = FALSE;
|
||||
UINT8 codec_cfg_status = A2D_SUCCESS;
|
||||
UNUSED(seid);
|
||||
UNUSED(addr);
|
||||
|
||||
@ -709,15 +709,15 @@ void bta_av_co_audio_setconfig(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
|
||||
#endif
|
||||
if (status == A2D_SUCCESS) {
|
||||
if (AVDT_TSEP_SNK == t_local_sep) {
|
||||
codec_cfg_supported = bta_av_co_audio_sink_supports_config(codec_type, p_codec_info);
|
||||
codec_cfg_status = bta_av_co_audio_sink_supports_config(codec_type, p_codec_info);
|
||||
APPL_TRACE_DEBUG(" Peer is A2DP SRC ");
|
||||
}
|
||||
if (AVDT_TSEP_SRC == t_local_sep) {
|
||||
codec_cfg_supported = bta_av_co_audio_media_supports_config(codec_type, p_codec_info);
|
||||
codec_cfg_status = bta_av_co_audio_media_supports_config(codec_type, p_codec_info);
|
||||
APPL_TRACE_DEBUG(" Peer is A2DP SINK ");
|
||||
}
|
||||
/* Check if codec configuration is supported */
|
||||
if (codec_cfg_supported) {
|
||||
if (codec_cfg_status == A2D_SUCCESS) {
|
||||
|
||||
/* Protect access to bta_av_co_cb.codec_cfg */
|
||||
osi_mutex_global_lock();
|
||||
@ -757,15 +757,15 @@ void bta_av_co_audio_setconfig(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
|
||||
osi_mutex_global_unlock();
|
||||
} else {
|
||||
category = AVDT_ASC_CODEC;
|
||||
status = A2D_WRONG_CODEC;
|
||||
status = A2D_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
if (status != A2D_SUCCESS) {
|
||||
APPL_TRACE_DEBUG("bta_av_co_audio_setconfig reject s=%d c=%d", status, category);
|
||||
APPL_TRACE_DEBUG("bta_av_co_audio_setconfig reject s=%d c=%d", codec_cfg_status, category);
|
||||
|
||||
/* Call call-in rejecting the configuration */
|
||||
bta_av_ci_setconfig(hndl, status, category, 0, NULL, FALSE, avdt_handle);
|
||||
bta_av_ci_setconfig(hndl, codec_cfg_status, category, 0, NULL, FALSE, avdt_handle);
|
||||
} else {
|
||||
/* Mark that this is an acceptor peer */
|
||||
p_peer->acp = TRUE;
|
||||
@ -1275,24 +1275,26 @@ static BOOLEAN bta_av_co_audio_peer_src_supports_codec(tBTA_AV_CO_PEER *p_peer,
|
||||
** Returns TRUE if the media source supports this config, FALSE otherwise
|
||||
**
|
||||
*******************************************************************************/
|
||||
static BOOLEAN bta_av_co_audio_sink_supports_config(UINT8 codec_type, const UINT8 *p_codec_cfg)
|
||||
static UINT8 bta_av_co_audio_sink_supports_config(UINT8 codec_type, const UINT8 *p_codec_cfg)
|
||||
{
|
||||
FUNC_TRACE();
|
||||
UINT8 status = A2D_BAD_CODEC_TYPE;
|
||||
|
||||
switch (codec_type) {
|
||||
case BTA_AV_CODEC_SBC:
|
||||
if (bta_av_sbc_cfg_in_cap((UINT8 *)p_codec_cfg, (tA2D_SBC_CIE *)&bta_av_co_sbc_sink_caps)) {
|
||||
return FALSE;
|
||||
}
|
||||
status = bta_av_sbc_cfg_in_cap((UINT8 *)p_codec_cfg, (tA2D_SBC_CIE *)&bta_av_co_sbc_sink_caps);
|
||||
break;
|
||||
case BTA_AV_CODEC_M12:
|
||||
case BTA_AV_CODEC_M24:
|
||||
case BTA_AV_CODEC_ATRAC:
|
||||
status = A2D_NS_CODEC_TYPE;
|
||||
APPL_TRACE_ERROR("bta_av_co_audio_sink_supports_config unsupported codec type %d", codec_type);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
APPL_TRACE_ERROR("bta_av_co_audio_media_supports_config unsupported codec type %d", codec_type);
|
||||
return FALSE;
|
||||
APPL_TRACE_ERROR("bta_av_co_audio_sink_supports_config invalid codec type %d", codec_type);
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
return status;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -1304,24 +1306,26 @@ static BOOLEAN bta_av_co_audio_sink_supports_config(UINT8 codec_type, const UINT
|
||||
** Returns TRUE if the media source supports this config, FALSE otherwise
|
||||
**
|
||||
*******************************************************************************/
|
||||
static BOOLEAN bta_av_co_audio_media_supports_config(UINT8 codec_type, const UINT8 *p_codec_cfg)
|
||||
static UINT8 bta_av_co_audio_media_supports_config(UINT8 codec_type, const UINT8 *p_codec_cfg)
|
||||
{
|
||||
FUNC_TRACE();
|
||||
UINT8 status = A2D_BAD_CODEC_TYPE;
|
||||
|
||||
switch (codec_type) {
|
||||
case BTA_AV_CODEC_SBC:
|
||||
if (bta_av_sbc_cfg_in_cap((UINT8 *)p_codec_cfg, (tA2D_SBC_CIE *)&bta_av_co_sbc_caps)) {
|
||||
return FALSE;
|
||||
}
|
||||
status = bta_av_sbc_cfg_in_cap((UINT8 *)p_codec_cfg, (tA2D_SBC_CIE *)&bta_av_co_sbc_caps);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
case BTA_AV_CODEC_M12:
|
||||
case BTA_AV_CODEC_M24:
|
||||
case BTA_AV_CODEC_ATRAC:
|
||||
status = A2D_NS_CODEC_TYPE;
|
||||
APPL_TRACE_ERROR("bta_av_co_audio_media_supports_config unsupported codec type %d", codec_type);
|
||||
return FALSE;
|
||||
break;
|
||||
default:
|
||||
APPL_TRACE_ERROR("bta_av_co_audio_media_supports_config invalid codec type %d", codec_type);
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
return status;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -105,7 +105,7 @@ tA2D_STATUS A2D_BldSbcInfo(UINT8 media_type, tA2D_SBC_CIE *p_ie, UINT8 *p_result
|
||||
******************************************************************************/
|
||||
tA2D_STATUS A2D_ParsSbcInfo(tA2D_SBC_CIE *p_ie, UINT8 *p_info, BOOLEAN for_caps)
|
||||
{
|
||||
tA2D_STATUS status;
|
||||
tA2D_STATUS status = A2D_SUCCESS;
|
||||
UINT8 losc;
|
||||
|
||||
if ( p_ie == NULL || p_info == NULL) {
|
||||
@ -127,7 +127,6 @@ tA2D_STATUS A2D_ParsSbcInfo(tA2D_SBC_CIE *p_ie, UINT8 *p_info, BOOLEAN for_caps)
|
||||
p_info++;
|
||||
p_ie->min_bitpool = *p_info++;
|
||||
p_ie->max_bitpool = *p_info;
|
||||
status = A2D_SUCCESS;
|
||||
if (p_ie->min_bitpool < A2D_SBC_IE_MIN_BITPOOL || p_ie->min_bitpool > A2D_SBC_IE_MAX_BITPOOL ) {
|
||||
status = A2D_BAD_MIN_BITPOOL;
|
||||
}
|
||||
@ -140,17 +139,13 @@ tA2D_STATUS A2D_ParsSbcInfo(tA2D_SBC_CIE *p_ie, UINT8 *p_info, BOOLEAN for_caps)
|
||||
if (for_caps == FALSE) {
|
||||
if (A2D_BitsSet(p_ie->samp_freq) != A2D_SET_ONE_BIT) {
|
||||
status = A2D_BAD_SAMP_FREQ;
|
||||
}
|
||||
if (A2D_BitsSet(p_ie->ch_mode) != A2D_SET_ONE_BIT) {
|
||||
} else if (A2D_BitsSet(p_ie->ch_mode) != A2D_SET_ONE_BIT) {
|
||||
status = A2D_BAD_CH_MODE;
|
||||
}
|
||||
if (A2D_BitsSet(p_ie->block_len) != A2D_SET_ONE_BIT) {
|
||||
} else if (A2D_BitsSet(p_ie->block_len) != A2D_SET_ONE_BIT) {
|
||||
status = A2D_BAD_BLOCK_LEN;
|
||||
}
|
||||
if (A2D_BitsSet(p_ie->num_subbands) != A2D_SET_ONE_BIT) {
|
||||
} else if (A2D_BitsSet(p_ie->num_subbands) != A2D_SET_ONE_BIT) {
|
||||
status = A2D_BAD_SUBBANDS;
|
||||
}
|
||||
if (A2D_BitsSet(p_ie->alloc_mthd) != A2D_SET_ONE_BIT) {
|
||||
} else if (A2D_BitsSet(p_ie->alloc_mthd) != A2D_SET_ONE_BIT) {
|
||||
status = A2D_BAD_ALLOC_MTHD;
|
||||
}
|
||||
}
|
||||
|
@ -788,25 +788,18 @@ void avdt_scb_hdl_setconfig_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
|
||||
if (!p_scb->in_use) {
|
||||
p_cfg = p_data->msg.config_cmd.p_cfg;
|
||||
if (p_scb->cs.cfg.codec_info[AVDT_CODEC_TYPE_INDEX] == p_cfg->codec_info[AVDT_CODEC_TYPE_INDEX]) {
|
||||
/* set sep as in use */
|
||||
p_scb->in_use = TRUE;
|
||||
/* set sep as in use */
|
||||
p_scb->in_use = TRUE;
|
||||
|
||||
/* copy info to scb */
|
||||
p_scb->p_ccb = avdt_ccb_by_idx(p_data->msg.config_cmd.hdr.ccb_idx);
|
||||
p_scb->peer_seid = p_data->msg.config_cmd.int_seid;
|
||||
memcpy(&p_scb->req_cfg, p_cfg, sizeof(tAVDT_CFG));
|
||||
/* call app callback */
|
||||
(*p_scb->cs.p_ctrl_cback)(avdt_scb_to_hdl(p_scb), /* handle of scb- which is same as sep handle of bta_av_cb.p_scb*/
|
||||
p_scb->p_ccb ? p_scb->p_ccb->peer_addr : NULL,
|
||||
AVDT_CONFIG_IND_EVT,
|
||||
(tAVDT_CTRL *) &p_data->msg.config_cmd);
|
||||
} else {
|
||||
p_data->msg.hdr.err_code = AVDT_ERR_UNSUP_CFG;
|
||||
p_data->msg.hdr.err_param = 0;
|
||||
avdt_msg_send_rej(avdt_ccb_by_idx(p_data->msg.hdr.ccb_idx),
|
||||
p_data->msg.hdr.sig_id, &p_data->msg);
|
||||
}
|
||||
/* copy info to scb */
|
||||
p_scb->p_ccb = avdt_ccb_by_idx(p_data->msg.config_cmd.hdr.ccb_idx);
|
||||
p_scb->peer_seid = p_data->msg.config_cmd.int_seid;
|
||||
memcpy(&p_scb->req_cfg, p_cfg, sizeof(tAVDT_CFG));
|
||||
/* call app callback */
|
||||
(*p_scb->cs.p_ctrl_cback)(avdt_scb_to_hdl(p_scb), /* handle of scb- which is same as sep handle of bta_av_cb.p_scb*/
|
||||
p_scb->p_ccb ? p_scb->p_ccb->peer_addr : NULL,
|
||||
AVDT_CONFIG_IND_EVT,
|
||||
(tAVDT_CTRL *) &p_data->msg.config_cmd);
|
||||
} else {
|
||||
avdt_scb_rej_in_use(p_scb, p_data);
|
||||
}
|
||||
|
@ -30,7 +30,8 @@
|
||||
** constants
|
||||
*****************************************************************************/
|
||||
#define A2D_VERSION 0x0102
|
||||
#define A2D_VERSION_SYC 0x0103
|
||||
#define A2D_VERSION_1_3 0x0103
|
||||
#define A2D_VERSION_1_4 0x0104
|
||||
|
||||
/* Profile supported features */
|
||||
#define A2D_SUPF_PLAYER 0x0001
|
||||
|
Loading…
Reference in New Issue
Block a user