add source handle the delay report

This commit is contained in:
xiongweichao 2022-03-30 16:28:54 +08:00 committed by BOT
parent 9126e4f07b
commit b0551ef456
5 changed files with 62 additions and 15 deletions

View File

@ -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;
/**

View File

@ -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);
}

View File

@ -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, &param);
}
/*****************************************************************************
** BTC ADAPTATION
*****************************************************************************/

View File

@ -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__ */

View File

@ -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);