diff --git a/components/bt/host/bluedroid/bta/av/bta_av_aact.c b/components/bt/host/bluedroid/bta/av/bta_av_aact.c index 748f0669d6..f8595f3110 100644 --- a/components/bt/host/bluedroid/bta/av/bta_av_aact.c +++ b/components/bt/host/bluedroid/bta/av/bta_av_aact.c @@ -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 */ diff --git a/components/bt/host/bluedroid/btc/profile/std/a2dp/btc_a2dp_source.c b/components/bt/host/bluedroid/btc/profile/std/a2dp/btc_a2dp_source.c index fbf861fd45..d388e94a6c 100644 --- a/components/bt/host/bluedroid/btc/profile/std/a2dp/btc_a2dp_source.c +++ b/components/bt/host/bluedroid/btc/profile/std/a2dp/btc_a2dp_source.c @@ -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 */ } /******************************************************************************* diff --git a/components/bt/host/bluedroid/common/include/common/bt_target.h b/components/bt/host/bluedroid/common/include/common/bt_target.h index 68d7902145..830e978a95 100644 --- a/components/bt/host/bluedroid/common/include/common/bt_target.h +++ b/components/bt/host/bluedroid/common/include/common/bt_target.h @@ -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