feat(voice): add local VAD speech endpoint detection

This commit is contained in:
chenjintao
2026-10-23 10:59:26 +08:00
parent ee32b4d63f
commit f17ce857ff
17 changed files with 1183 additions and 141 deletions
@@ -388,7 +388,10 @@ typedef struct {
TaskHandle_t uplink_send_task;
volatile bool uplink_recording_active;
volatile bool uplink_task_exit_requested;
volatile bool uplink_send_in_flight;
bool uplink_send_in_flight;
bool uplink_tail_flush_requested;
bool uplink_stop_incomplete;
esp_err_t uplink_tail_flush_error;
bool uplink_first_network_pcm_pending;
bool uplink_first_network_packet_pending;
TickType_t uplink_network_start_tick;
@@ -412,9 +415,21 @@ static bool s_downstream_last_terminal_valid;
static uint32_t s_downstream_last_terminal_generation;
static multimodal_audio_downstream_playback_event_type_t
s_downstream_last_terminal_type;
static multimodal_audio_pcm_observer_t s_pcm_observer;
static void *s_pcm_observer_ctx;
static uint32_t s_pcm_observer_in_flight;
#define MULTIMODAL_AUDIO_PCM_OBSERVER_SLOTS 2U
typedef struct {
multimodal_audio_pcm_observer_t callback;
void *ctx;
uint32_t in_flight;
uint32_t registration;
bool enabled;
} audio_pcm_observer_slot_t;
static audio_pcm_observer_slot_t s_pcm_observers[MULTIMODAL_AUDIO_PCM_OBSERVER_SLOTS];
static uint32_t s_pcm_observer_registration;
static StaticSemaphore_t s_uplink_capture_mutex_storage;
static SemaphoreHandle_t s_uplink_capture_mutex;
static StaticSemaphore_t s_uplink_lifecycle_mutex_storage;
static SemaphoreHandle_t s_uplink_lifecycle_mutex;
static bool s_uplink_capture_mutex_initializing;
static portMUX_TYPE s_pcm_observer_lock = portMUX_INITIALIZER_UNLOCKED;
static bool s_uplink_stack_warned;
static bool s_uplink_send_stack_warned;