From 49c356ab18c48e9bb58d48b75905651c56c944a6 Mon Sep 17 00:00:00 2001 From: liqigan Date: Mon, 4 Nov 2024 16:06:08 +0800 Subject: [PATCH] fix(bt/bluedroid): Fixed AVRCP compatibility issue on absolute volume synchronization --- .../bluedroid/btc/profile/std/avrc/btc_avrc.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/components/bt/host/bluedroid/btc/profile/std/avrc/btc_avrc.c b/components/bt/host/bluedroid/btc/profile/std/avrc/btc_avrc.c index dde3728dbca0..738fbfd3c930 100644 --- a/components/bt/host/bluedroid/btc/profile/std/avrc/btc_avrc.c +++ b/components/bt/host/bluedroid/btc/profile/std/avrc/btc_avrc.c @@ -170,8 +170,7 @@ bool btc_avrc_ct_init_p(void) bool btc_avrc_tg_connected_p(void) { return (s_rc_tg_init == BTC_RC_TG_INIT_MAGIC) && - (btc_rc_cb.rc_connected == TRUE) && - (btc_rc_cb.rc_features & BTA_AV_FEAT_RCCT); + (btc_rc_cb.rc_connected == TRUE); } bool btc_avrc_ct_connected_p(void) @@ -456,7 +455,7 @@ static void handle_rc_connect (tBTA_AV_RC_OPEN *p_rc_open) btc_avrc_ct_cb_to_app(ESP_AVRC_CT_CONNECTION_STATE_EVT, ¶m); } - if (p_rc_open->peer_features & BTA_AV_FEAT_RCCT) { + if (btc_avrc_tg_init_p()) { esp_avrc_tg_cb_param_t param; memset(¶m, 0, sizeof(esp_avrc_tg_cb_param_t)); param.conn_stat.connected = true; @@ -515,7 +514,7 @@ static void handle_rc_disconnect (tBTA_AV_RC_CLOSE *p_rc_close) btc_avrc_ct_cb_to_app(ESP_AVRC_CT_CONNECTION_STATE_EVT, ¶m); } - if (rc_features & BTA_AV_FEAT_RCCT) { + if (btc_avrc_tg_init_p()) { esp_avrc_tg_cb_param_t param; memset(¶m, 0, sizeof(esp_avrc_ct_cb_param_t)); param.conn_stat.connected = false; @@ -941,14 +940,10 @@ void btc_rc_handler(tBTA_AV_EVT event, tBTA_AV *p_data) memcpy(param.conn_stat.remote_bda, btc_rc_cb.rc_addr, sizeof(esp_bd_addr_t)); btc_avrc_ct_cb_to_app(ESP_AVRC_CT_CONNECTION_STATE_EVT, ¶m); } - if ((p_data->rc_feat.peer_features & BTA_AV_FEAT_RCCT) && - !(old_feats & BTA_AV_FEAT_RCCT)) { - esp_avrc_tg_cb_param_t param; - memset(¶m, 0, sizeof(esp_avrc_ct_cb_param_t)); - param.conn_stat.connected = true; - memcpy(param.conn_stat.remote_bda, btc_rc_cb.rc_addr, sizeof(esp_bd_addr_t)); - btc_avrc_tg_cb_to_app(ESP_AVRC_TG_CONNECTION_STATE_EVT, ¶m); - } + /** + * @note ESP_AVRC_TG_CONNECTION_STATE_EVT has been reported on rc connect/disconnect event, + * it doesn't rely on the SDP results. + */ } while (0); btc_rc_cb.rc_features = p_data->rc_feat.peer_features; btc_rc_cb.rc_ct_features = p_data->rc_feat.peer_ct_features;