mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-22 13:01:16 +03:00
Merge branch 'opt/hfp_audio_quality' into 'master'
change(bt/bluedroid): optimized the HFP example workflow to improve audio quality See merge request espressif/esp-idf!51346
This commit is contained in:
@@ -326,11 +326,15 @@ void bt_app_hf_cb(esp_hf_cb_event_t event, esp_hf_cb_param_t *param)
|
||||
}
|
||||
s_time_old = esp_timer_get_time();
|
||||
esp_hf_ag_register_data_callback(bt_app_hf_incoming_cb, bt_app_hf_outgoing_cb);
|
||||
/* Disable connectable and discoverable mode to save the over-the-air bandwidth and ensure audio quality */
|
||||
esp_bt_gap_set_scan_mode(ESP_BT_NON_CONNECTABLE, ESP_BT_NON_DISCOVERABLE);
|
||||
/* Begin send esco data task */
|
||||
bt_app_send_data();
|
||||
} else if (param->audio_stat.state == ESP_HF_AUDIO_STATE_DISCONNECTED) {
|
||||
ESP_LOGI(BT_HF_TAG, "--ESP AG Audio Connection Disconnected.");
|
||||
bt_app_send_data_shut_down();
|
||||
/* Resume connectable and discoverable mode */
|
||||
esp_bt_gap_set_scan_mode(ESP_BT_CONNECTABLE, ESP_BT_GENERAL_DISCOVERABLE);
|
||||
}
|
||||
#endif /* #if CONFIG_BT_HFP_AUDIO_DATA_PATH_HCI */
|
||||
break;
|
||||
|
||||
@@ -332,6 +332,8 @@ void bt_app_hf_client_cb(esp_hf_client_cb_event_t event, esp_hf_client_cb_param_
|
||||
s_sync_conn_hdl = param->audio_stat.sync_conn_handle;
|
||||
s_audio_buff_queue = xQueueCreate(50, sizeof(esp_hf_audio_buff_t*));
|
||||
esp_hf_client_register_audio_data_callback(bt_app_hf_client_audio_data_cb);
|
||||
/* Disable connectable and discoverable mode to save the over-the-air bandwidth and ensure audio quality */
|
||||
esp_bt_gap_set_scan_mode(ESP_BT_NON_CONNECTABLE, ESP_BT_NON_DISCOVERABLE);
|
||||
} else if (param->audio_stat.state == ESP_HF_CLIENT_AUDIO_STATE_DISCONNECTED) {
|
||||
s_sync_conn_hdl = 0;
|
||||
s_msbc_air_mode = false;
|
||||
@@ -344,6 +346,8 @@ void bt_app_hf_client_cb(esp_hf_client_cb_event_t event, esp_hf_client_cb_param_
|
||||
s_audio_buff_queue = NULL;
|
||||
}
|
||||
s_audio_buff_cnt = 0;
|
||||
/* Resume connectable and discoverable mode */
|
||||
esp_bt_gap_set_scan_mode(ESP_BT_CONNECTABLE, ESP_BT_GENERAL_DISCOVERABLE);
|
||||
}
|
||||
#else
|
||||
if (param->audio_stat.state == ESP_HF_CLIENT_AUDIO_STATE_CONNECTED ||
|
||||
|
||||
Reference in New Issue
Block a user