feat(voice): add local VAD speech endpoint detection
This commit is contained in:
@@ -682,7 +682,10 @@ esp_err_t control_plane_multimodal_handle_ptt_press_step(void)
|
||||
|
||||
esp_err_t control_plane_multimodal_handle_ptt_release(void)
|
||||
{
|
||||
control_plane_multimodal_stop_uplink();
|
||||
esp_err_t err = control_plane_multimodal_stop_uplink();
|
||||
if (err != ESP_OK) {
|
||||
return err;
|
||||
}
|
||||
return control_plane_multimodal_send_speech_stop();
|
||||
}
|
||||
|
||||
|
||||
@@ -2356,6 +2356,9 @@ esp_err_t control_plane_multimodal_send_speech_stop(void)
|
||||
esp_err_t err = ESP_OK;
|
||||
if (transport_available() && has_active_task) {
|
||||
err = send_directive("continue-task", "StopSpeech", true, false);
|
||||
if (err == ESP_OK) {
|
||||
ESP_LOGI(TAG, "StopSpeech sent after uplink drain");
|
||||
}
|
||||
}
|
||||
|
||||
if (lock_state()) {
|
||||
@@ -2678,15 +2681,14 @@ esp_err_t control_plane_multimodal_start_uplink(void)
|
||||
return domain_runtime_multimodal_audio_start_uplink(control_plane_audio_uplink_send_cb, NULL);
|
||||
}
|
||||
|
||||
void control_plane_multimodal_stop_uplink(void)
|
||||
esp_err_t control_plane_multimodal_stop_uplink(void)
|
||||
{
|
||||
if (!domain_runtime_multimodal_audio_is_uplink_running()) {
|
||||
return;
|
||||
}
|
||||
/* 即便采集已暂停,上次 stop 超时的队列/在途发送仍需要重试排空。 */
|
||||
esp_err_t err = domain_runtime_multimodal_audio_stop_uplink(CONTROL_PLANE_UPLINK_READY_WAIT_MS);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGW(TAG, "Mic uplink stop ended with %s", esp_err_to_name(err));
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
bool control_plane_multimodal_is_uplink_running(void)
|
||||
|
||||
Reference in New Issue
Block a user