diff --git a/components/bt/host/bluedroid/api/include/api/esp_a2dp_api.h b/components/bt/host/bluedroid/api/include/api/esp_a2dp_api.h index 1ff85c2efe..e378891c66 100644 --- a/components/bt/host/bluedroid/api/include/api/esp_a2dp_api.h +++ b/components/bt/host/bluedroid/api/include/api/esp_a2dp_api.h @@ -171,6 +171,13 @@ typedef union { uint16_t delay_value; /*!< delay report value */ } a2d_get_delay_value_stat; /*!< A2DP sink get delay report value status */ + /** + * @brief ESP_A2D_REPORT_SNK_DELAY_VALUE_EVT + */ + struct a2d_report_delay_stat_param { + uint16_t delay_value; /*!< delay report value */ + } a2d_report_delay_value_stat; /*!< A2DP source received sink report value status */ + } esp_a2d_cb_param_t; /** diff --git a/components/bt/host/bluedroid/btc/profile/std/a2dp/bta_av_co.c b/components/bt/host/bluedroid/btc/profile/std/a2dp/bta_av_co.c index 5a006e8411..8898d89055 100644 --- a/components/bt/host/bluedroid/btc/profile/std/a2dp/bta_av_co.c +++ b/components/bt/host/bluedroid/btc/profile/std/a2dp/bta_av_co.c @@ -979,10 +979,11 @@ void bta_av_co_audio_drop(tBTA_AV_HNDL hndl) *******************************************************************************/ void bta_av_co_audio_delay(tBTA_AV_HNDL hndl, UINT16 delay) { - // todo FUNC_TRACE(); - APPL_TRACE_ERROR("bta_av_co_audio_delay handle: x%x, delay:0x%x", hndl, delay); + btc_source_report_delay_value(delay); + + APPL_TRACE_DEBUG("bta_av_co_audio_delay handle: x%x, delay:0x%x", hndl, delay); } 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 b35ac83fa5..a1e08de278 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 @@ -424,7 +424,6 @@ void btc_a2dp_source_set_tx_flush(BOOLEAN enable) ** Returns ** *******************************************************************************/ - void btc_a2dp_source_setup_codec(void) { tBTC_AV_MEDIA_FEEDINGS media_feeding; @@ -617,6 +616,30 @@ BOOLEAN btc_a2dp_source_tx_flush_req(void) return TRUE; } +/***************************************************************************** +** +** Function btc_source_report_delay_value +** +** Description +** +** Returns +** +*******************************************************************************/ +void btc_source_report_delay_value(UINT16 delay_value) +{ + esp_a2d_cb_param_t param; + +#if A2D_DYNAMIC_MEMORY == TRUE + if (a2dp_source_local_param_ptr == NULL) { + return; + } +#endif + + param.a2d_report_delay_value_stat.delay_value = delay_value; + + btc_aa_cb_to_app(ESP_A2D_REPORT_SNK_DELAY_VALUE_EVT, ¶m); +} + /***************************************************************************** ** BTC ADAPTATION *****************************************************************************/ diff --git a/components/bt/host/bluedroid/btc/profile/std/include/btc_a2dp_source.h b/components/bt/host/bluedroid/btc/profile/std/include/btc_a2dp_source.h index adb7bba9d8..f7ce1cbc10 100644 --- a/components/bt/host/bluedroid/btc/profile/std/include/btc_a2dp_source.h +++ b/components/bt/host/bluedroid/btc/profile/std/include/btc_a2dp_source.h @@ -231,6 +231,15 @@ void btc_a2dp_source_set_tx_flush(BOOLEAN enable); *******************************************************************************/ void btc_a2dp_source_encoder_update(void); +/***************************************************************************** +** +** Function btc_source_report_delay_value +** +** Description Report sink delay report value +** +*******************************************************************************/ +void btc_source_report_delay_value(UINT16 delay_value); + #endif /* #if BTC_AV_SRC_INCLUDED */ #endif /* __BTC_A2DP_SOURCE_H__ */ diff --git a/components/bt/host/bluedroid/stack/avdt/avdt_scb_act.c b/components/bt/host/bluedroid/stack/avdt/avdt_scb_act.c index 44ff388878..6922e5981b 100644 --- a/components/bt/host/bluedroid/stack/avdt/avdt_scb_act.c +++ b/components/bt/host/bluedroid/stack/avdt/avdt_scb_act.c @@ -872,12 +872,14 @@ void avdt_scb_init_open_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data) tAVDT_EVT_HDR single; UNUSED(p_data); - if (!(p_scb->curr_cfg.psc_mask & AVDT_PSC_DELAY_RPT)) { - /* initiate open */ - single.seid = p_scb->peer_seid; - avdt_scb_event(p_scb, AVDT_SCB_API_OPEN_REQ_EVT, (tAVDT_SCB_EVT *) &single); - } else { - btu_start_timer(&p_scb->timer_entry, BTU_TTYPE_AVDT_SCB_DELAY_RPT, AVDT_SCB_TC_DELAY_RPT_TOUT); + if (p_scb->p_ccb != NULL && p_scb->role == AVDT_CONF_INT) { + if (!(p_scb->curr_cfg.psc_mask & AVDT_PSC_DELAY_RPT)) { + /* initiate open */ + single.seid = p_scb->peer_seid; + avdt_scb_event(p_scb, AVDT_SCB_API_OPEN_REQ_EVT, (tAVDT_SCB_EVT *) &single); + } else { + btu_start_timer(&p_scb->timer_entry, BTU_TTYPE_AVDT_SCB_DELAY_RPT, AVDT_SCB_TC_DELAY_RPT_TOUT); + } } } @@ -1080,12 +1082,17 @@ void avdt_scb_hdl_delay_rpt_cmd (tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data) (tAVDT_CTRL *) &p_data->msg.hdr); if (p_scb->p_ccb) { - avdt_msg_send_rsp(p_scb->p_ccb, AVDT_SIG_DELAY_RPT, &p_data->msg); - if(p_scb->role == AVDT_CONF_INT) { - btu_stop_timer(&p_scb->timer_entry); - /* initiate open */ - single.seid = p_scb->peer_seid; - avdt_scb_event(p_scb, AVDT_SCB_API_OPEN_REQ_EVT, (tAVDT_SCB_EVT *) &single); + if (p_scb->cs.cfg.psc_mask & AVDT_PSC_DELAY_RPT) { + avdt_msg_send_rsp(p_scb->p_ccb, AVDT_SIG_DELAY_RPT, &p_data->msg); + if(p_scb->role == AVDT_CONF_INT) { + btu_stop_timer(&p_scb->timer_entry); + /* initiate open */ + single.seid = p_scb->peer_seid; + avdt_scb_event(p_scb, AVDT_SCB_API_OPEN_REQ_EVT, (tAVDT_SCB_EVT *) &single); + } + } else { + p_data->msg.hdr.err_code = AVDT_ERR_NSC; + avdt_msg_send_rej(p_scb->p_ccb, AVDT_SIG_DELAY_RPT, &p_data->msg); } } else { avdt_scb_rej_not_in_use(p_scb, p_data);