WS刚连接成功可以进行 对话,超过30sWS断开后,语音上行停止,需要修复
This commit is contained in:
@@ -298,6 +298,7 @@ typedef struct {
|
||||
TaskHandle_t uplink_send_task;
|
||||
volatile bool uplink_recording_active;
|
||||
volatile bool uplink_task_exit_requested;
|
||||
volatile bool uplink_send_in_flight;
|
||||
multimodal_audio_uplink_cb_t uplink_cb;
|
||||
void *uplink_cb_ctx;
|
||||
bool opus_ready;
|
||||
|
||||
@@ -664,7 +664,9 @@ static void uplink_send_task(void *arg)
|
||||
continue;
|
||||
}
|
||||
|
||||
ctx->uplink_send_in_flight = true;
|
||||
esp_err_t send_err = cb(packet.data, packet.len, cb_ctx);
|
||||
ctx->uplink_send_in_flight = false;
|
||||
track_uplink_send_result(send_err, packet.len);
|
||||
if (send_err != ESP_OK && send_err != ESP_ERR_INVALID_STATE) {
|
||||
if (send_err != ESP_ERR_TIMEOUT) {
|
||||
@@ -1030,9 +1032,27 @@ esp_err_t multimodal_audio_stop_uplink(int timeout_ms)
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
(void)timeout_ms;
|
||||
audio_set_uplink_recording_active(&s_audio, false);
|
||||
reset_uplink_send_queue(&s_audio);
|
||||
|
||||
TickType_t deadline = xTaskGetTickCount() + pdMS_TO_TICKS((uint32_t)timeout_ms);
|
||||
while (((s_audio.uplink_send_queue != NULL &&
|
||||
uxQueueMessagesWaiting(s_audio.uplink_send_queue) > 0U) ||
|
||||
s_audio.uplink_send_in_flight) &&
|
||||
xTaskGetTickCount() < deadline) {
|
||||
vTaskDelay(pdMS_TO_TICKS(20));
|
||||
}
|
||||
|
||||
if ((s_audio.uplink_send_queue != NULL &&
|
||||
uxQueueMessagesWaiting(s_audio.uplink_send_queue) > 0U) ||
|
||||
s_audio.uplink_send_in_flight) {
|
||||
ESP_LOGW(TAG,
|
||||
"Mic uplink stop timed out with %u queued packet(s), in_flight=%d",
|
||||
(unsigned)((s_audio.uplink_send_queue != NULL) ?
|
||||
uxQueueMessagesWaiting(s_audio.uplink_send_queue) : 0U),
|
||||
s_audio.uplink_send_in_flight ? 1 : 0);
|
||||
reset_uplink_send_queue(&s_audio);
|
||||
}
|
||||
|
||||
audio_set_uplink_callback(&s_audio, NULL, NULL);
|
||||
s_audio.uplink_mono_fill_bytes = 0U;
|
||||
log_heap_snapshot("after_uplink_stop");
|
||||
|
||||
Reference in New Issue
Block a user