Merge branch 'bugfix/a2dp_error_code_v5.0' into 'release/v5.0'

bt: Update A2DP version to v1.4(v5.0)

See merge request espressif/esp-idf!21622
This commit is contained in:
Jiang Jiang Jian
2022-12-19 10:46:58 +08:00
11 changed files with 56 additions and 61 deletions

View File

@@ -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); bta_av_adjust_seps_idx(p_scb, avdt_handle);
APPL_TRACE_DEBUG("bta_av_setconfig_rej: sep_idx: %d", p_scb->sep_idx); 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); bdcpy(reject.bd_addr, p_data->str_msg.bd_addr);
reject.hndl = p_scb->hndl; reject.hndl = p_scb->hndl;

View File

@@ -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) { if (bta_av_cb.features & BTA_AV_FEAT_DELAY_RPT) {
cs.cfg.psc_mask |= AVDT_PSC_DELAY_RPT; cs.cfg.psc_mask |= AVDT_PSC_DELAY_RPT;
a2d_set_avdt_sdp_ver(AVDT_VERSION_SYNC); 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 */ /* keep the configuration in the stream control block */

View File

@@ -272,7 +272,7 @@ const tBTA_AG_ST_TBL bta_ag_st_tbl[] =
/***************************************************************************** /*****************************************************************************
** Global data ** 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 */ /* AG control block */
#if BTA_DYNAMIC_MEMORY == FALSE #if BTA_DYNAMIC_MEMORY == FALSE
tBTA_AG_CB bta_ag_cb; tBTA_AG_CB bta_ag_cb;

View File

@@ -157,7 +157,7 @@ BOOLEAN bta_ag_add_record(UINT16 service_uuid, char *p_service_name, UINT8 scn,
/* add profile descriptor list */ /* add profile descriptor list */
if (service_uuid == UUID_SERVCLASS_AG_HANDSFREE) { if (service_uuid == UUID_SERVCLASS_AG_HANDSFREE) {
profile_uuid = UUID_SERVCLASS_HF_HANDSFREE; profile_uuid = UUID_SERVCLASS_HF_HANDSFREE;
version = HFP_VERSION_1_7; version = HFP_VERSION_1_8;
} else { } else {
profile_uuid = UUID_SERVCLASS_HEADSET; profile_uuid = UUID_SERVCLASS_HEADSET;
version = HSP_VERSION_1_2; version = HSP_VERSION_1_2;

View File

@@ -49,6 +49,7 @@
#define HFP_VERSION_1_5 0x0105 #define HFP_VERSION_1_5 0x0105
#define HFP_VERSION_1_6 0x0106 #define HFP_VERSION_1_6 0x0106
#define HFP_VERSION_1_7 0x0107 #define HFP_VERSION_1_7 0x0107
#define HFP_VERSION_1_8 0x0108
#define HSP_VERSION_1_0 0x0100 #define HSP_VERSION_1_0 0x0100
#define HSP_VERSION_1_2 0x0102 #define HSP_VERSION_1_2 0x0102

View File

@@ -114,7 +114,7 @@ BOOLEAN bta_hf_client_add_record(char *p_service_name, UINT8 scn,
/* add profile descriptor list */ /* add profile descriptor list */
profile_uuid = UUID_SERVCLASS_HF_HANDSFREE; profile_uuid = UUID_SERVCLASS_HF_HANDSFREE;
version = HFP_VERSION_1_7; version = HFP_VERSION_1_8;
result &= SDP_AddProfileDescriptorList(sdp_handle, profile_uuid, version); result &= SDP_AddProfileDescriptorList(sdp_handle, profile_uuid, version);

View File

@@ -30,6 +30,7 @@
#define HFP_VERSION_1_5 0x0105 #define HFP_VERSION_1_5 0x0105
#define HFP_VERSION_1_6 0x0106 #define HFP_VERSION_1_6 0x0106
#define HFP_VERSION_1_7 0x0107 #define HFP_VERSION_1_7 0x0107
#define HFP_VERSION_1_8 0x0108
/* RFCOMM MTU SIZE */ /* RFCOMM MTU SIZE */
#define BTA_HF_CLIENT_MTU 256 #define BTA_HF_CLIENT_MTU 256

View File

@@ -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_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_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_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 UINT8 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_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); 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 status = A2D_SUCCESS;
UINT8 category = A2D_SUCCESS; UINT8 category = A2D_SUCCESS;
BOOLEAN recfg_needed = FALSE; BOOLEAN recfg_needed = FALSE;
BOOLEAN codec_cfg_supported = FALSE; UINT8 codec_cfg_status = A2D_SUCCESS;
UNUSED(seid); UNUSED(seid);
UNUSED(addr); UNUSED(addr);
@@ -709,15 +709,15 @@ void bta_av_co_audio_setconfig(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
#endif #endif
if (status == A2D_SUCCESS) { if (status == A2D_SUCCESS) {
if (AVDT_TSEP_SNK == t_local_sep) { 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 "); APPL_TRACE_DEBUG(" Peer is A2DP SRC ");
} }
if (AVDT_TSEP_SRC == t_local_sep) { 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 "); APPL_TRACE_DEBUG(" Peer is A2DP SINK ");
} }
/* Check if codec configuration is supported */ /* 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 */ /* Protect access to bta_av_co_cb.codec_cfg */
osi_mutex_global_lock(); 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(); osi_mutex_global_unlock();
} else { } else {
category = AVDT_ASC_CODEC; category = AVDT_ASC_CODEC;
status = A2D_WRONG_CODEC; status = A2D_FAIL;
} }
} }
if (status != A2D_SUCCESS) { 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 */ /* 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 { } else {
/* Mark that this is an acceptor peer */ /* Mark that this is an acceptor peer */
p_peer->acp = TRUE; 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 ** 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(); FUNC_TRACE();
UINT8 status = A2D_BAD_CODEC_TYPE;
switch (codec_type) { switch (codec_type) {
case BTA_AV_CODEC_SBC: 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)) { status = bta_av_sbc_cfg_in_cap((UINT8 *)p_codec_cfg, (tA2D_SBC_CIE *)&bta_av_co_sbc_sink_caps);
return FALSE; 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; break;
default: default:
APPL_TRACE_ERROR("bta_av_co_audio_media_supports_config unsupported codec type %d", codec_type); APPL_TRACE_ERROR("bta_av_co_audio_sink_supports_config invalid codec type %d", codec_type);
return FALSE;
break; 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 ** 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(); FUNC_TRACE();
UINT8 status = A2D_BAD_CODEC_TYPE;
switch (codec_type) { switch (codec_type) {
case BTA_AV_CODEC_SBC: case BTA_AV_CODEC_SBC:
if (bta_av_sbc_cfg_in_cap((UINT8 *)p_codec_cfg, (tA2D_SBC_CIE *)&bta_av_co_sbc_caps)) { status = bta_av_sbc_cfg_in_cap((UINT8 *)p_codec_cfg, (tA2D_SBC_CIE *)&bta_av_co_sbc_caps);
return FALSE;
}
break; break;
case BTA_AV_CODEC_M12:
case BTA_AV_CODEC_M24:
default: 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); 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; break;
} }
return TRUE; return status;
} }
/******************************************************************************* /*******************************************************************************

View File

@@ -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 A2D_ParsSbcInfo(tA2D_SBC_CIE *p_ie, UINT8 *p_info, BOOLEAN for_caps)
{ {
tA2D_STATUS status; tA2D_STATUS status = A2D_SUCCESS;
UINT8 losc; UINT8 losc;
if ( p_ie == NULL || p_info == NULL) { 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_info++;
p_ie->min_bitpool = *p_info++; p_ie->min_bitpool = *p_info++;
p_ie->max_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 ) { if (p_ie->min_bitpool < A2D_SBC_IE_MIN_BITPOOL || p_ie->min_bitpool > A2D_SBC_IE_MAX_BITPOOL ) {
status = A2D_BAD_MIN_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 (for_caps == FALSE) {
if (A2D_BitsSet(p_ie->samp_freq) != A2D_SET_ONE_BIT) { if (A2D_BitsSet(p_ie->samp_freq) != A2D_SET_ONE_BIT) {
status = A2D_BAD_SAMP_FREQ; status = A2D_BAD_SAMP_FREQ;
} } else if (A2D_BitsSet(p_ie->ch_mode) != A2D_SET_ONE_BIT) {
if (A2D_BitsSet(p_ie->ch_mode) != A2D_SET_ONE_BIT) {
status = A2D_BAD_CH_MODE; status = A2D_BAD_CH_MODE;
} } else if (A2D_BitsSet(p_ie->block_len) != A2D_SET_ONE_BIT) {
if (A2D_BitsSet(p_ie->block_len) != A2D_SET_ONE_BIT) {
status = A2D_BAD_BLOCK_LEN; status = A2D_BAD_BLOCK_LEN;
} } else if (A2D_BitsSet(p_ie->num_subbands) != A2D_SET_ONE_BIT) {
if (A2D_BitsSet(p_ie->num_subbands) != A2D_SET_ONE_BIT) {
status = A2D_BAD_SUBBANDS; status = A2D_BAD_SUBBANDS;
} } else if (A2D_BitsSet(p_ie->alloc_mthd) != A2D_SET_ONE_BIT) {
if (A2D_BitsSet(p_ie->alloc_mthd) != A2D_SET_ONE_BIT) {
status = A2D_BAD_ALLOC_MTHD; status = A2D_BAD_ALLOC_MTHD;
} }
} }

View File

@@ -788,7 +788,6 @@ void avdt_scb_hdl_setconfig_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
if (!p_scb->in_use) { if (!p_scb->in_use) {
p_cfg = p_data->msg.config_cmd.p_cfg; 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 */ /* set sep as in use */
p_scb->in_use = TRUE; p_scb->in_use = TRUE;
@@ -801,12 +800,6 @@ void avdt_scb_hdl_setconfig_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
p_scb->p_ccb ? p_scb->p_ccb->peer_addr : NULL, p_scb->p_ccb ? p_scb->p_ccb->peer_addr : NULL,
AVDT_CONFIG_IND_EVT, AVDT_CONFIG_IND_EVT,
(tAVDT_CTRL *) &p_data->msg.config_cmd); (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);
}
} else { } else {
avdt_scb_rej_in_use(p_scb, p_data); avdt_scb_rej_in_use(p_scb, p_data);
} }

View File

@@ -30,7 +30,8 @@
** constants ** constants
*****************************************************************************/ *****************************************************************************/
#define A2D_VERSION 0x0102 #define A2D_VERSION 0x0102
#define A2D_VERSION_SYC 0x0103 #define A2D_VERSION_1_3 0x0103
#define A2D_VERSION_1_4 0x0104
/* Profile supported features */ /* Profile supported features */
#define A2D_SUPF_PLAYER 0x0001 #define A2D_SUPF_PLAYER 0x0001