Merge branch 'test/bqb_test_bt_classic_a2dp_v5.0' into 'release/v5.0'

feat(bt/bqb): Add setting SBC encoder and reject invalid codec type support for a2dp BQB test (backport v5.0)

See merge request espressif/esp-idf!25685
This commit is contained in:
Wang Meng Yang 2023-09-18 11:02:56 +08:00
commit 1b4464a6be
3 changed files with 43 additions and 3 deletions

View File

@ -733,8 +733,7 @@ static void bta_av_adjust_seps_idx(tBTA_AV_SCB *p_scb, UINT8 avdt_handle)
for (xx = 0; xx < BTA_AV_MAX_SEPS; xx++) {
APPL_TRACE_DEBUG("av_handle: %d codec_type: %d",
p_scb->seps[xx].av_handle, p_scb->seps[xx].codec_type);
if ((p_scb->seps[xx].av_handle && p_scb->codec_type == p_scb->seps[xx].codec_type)
&& (p_scb->seps[xx].av_handle == avdt_handle)) {
if ((p_scb->seps[xx].av_handle) && (p_scb->seps[xx].av_handle == avdt_handle)) {
p_scb->sep_idx = xx;
p_scb->avdt_handle = p_scb->seps[xx].av_handle;
break;
@ -1027,6 +1026,7 @@ void bta_av_cleanup(tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data)
p_scb->wait = 0;
p_scb->num_disc_snks = 0;
p_scb->disc_rsn = 0;
p_scb->avdt_handle = 0;
bta_sys_stop_timer(&p_scb->timer);
if (p_scb->deregistring) {
/* remove stream */

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -42,6 +42,13 @@
#if BTC_AV_SRC_INCLUDED
/*****************************************************************************
** BQB global variables
*****************************************************************************/
#if A2D_SRC_BQB_INCLUDED
bool a2dp_src_bqb_set_sbc_encoder_flag = FALSE;
#endif /* A2D_SRC_BQB_INCLUDED */
/*****************************************************************************
** Constants
*****************************************************************************/
@ -928,6 +935,27 @@ static void btc_a2dp_source_enc_update(BT_HDR *p_msg)
}
}
#if A2D_SRC_BQB_INCLUDED
/*******************************************************************************
**
** Function btc_a2dp_source_bqb_sbc_encoder_set
**
** Description Set SBC encoder for bqb test cases A2DP/SRC/SET/BV-04-I and A2DP/SRC/SET/BV-06-I
**
** Returns void
**
*******************************************************************************/
void btc_a2dp_source_bqb_sbc_encoder_set(void)
{
a2dp_source_local_param.btc_aa_src_cb.encoder.s16NumOfSubBands = 8;
a2dp_source_local_param.btc_aa_src_cb.encoder.s16NumOfBlocks = 8;
a2dp_source_local_param.btc_aa_src_cb.encoder.s16AllocationMethod = SBC_LOUDNESS;
a2dp_source_local_param.btc_aa_src_cb.encoder.s16ChannelMode = SBC_MONO;
a2dp_source_local_param.btc_aa_src_cb.encoder.s16SamplingFreq = SBC_sf44100;
SBC_Encoder_Init(&(a2dp_source_local_param.btc_aa_src_cb.encoder));
}
#endif /* A2D_SRC_BQB_INCLUDED */
/*******************************************************************************
**
** Function btc_a2dp_source_pcm2sbc_init
@ -998,6 +1026,12 @@ static void btc_a2dp_source_pcm2sbc_init(tBTC_MEDIA_INIT_AUDIO_FEEDING *p_feedin
} else {
APPL_TRACE_DEBUG("%s no SBC reconfig needed", __FUNCTION__);
}
#if A2D_SRC_BQB_INCLUDED
if (a2dp_src_bqb_set_sbc_encoder_flag) {
btc_a2dp_source_bqb_sbc_encoder_set();
}
#endif /* A2D_SRC_BQB_INCLUDED */
}
/*******************************************************************************

View File

@ -2060,6 +2060,12 @@
#define A2D_INCLUDED FALSE
#endif
#if (BTC_AV_SRC_INCLUDED == TRUE) && (BT_CLASSIC_BQB_INCLUDED == TRUE)
#define A2D_SRC_BQB_INCLUDED TRUE
#else
#define A2D_SRC_BQB_INCLUDED FALSE
#endif
/******************************************************************************
**
** AVCTP