mirror of
https://github.com/ggml-org/whisper.cpp.git
synced 2026-08-12 22:31:22 +04:00
whisper : add stateless VAD detect + explicit state reset for streaming (#3677)
whisper_vad_detect_speech resets LSTM state on every call, which is correct for batch processing but prevents temporal continuity when calling per-chunk in a streaming loop. Add whisper_vad_detect_speech_no_reset (skips buffer clear) and whisper_vad_reset_state (explicit clear between utterances). Existing whisper_vad_detect_speech is now a thin wrapper — zero behavior change for current callers. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
95ea8f9bfb
commit
166c20b473
@@ -695,6 +695,16 @@ extern "C" {
|
||||
const float * samples,
|
||||
int n_samples);
|
||||
|
||||
// Like whisper_vad_detect_speech, but does not reset LSTM state.
|
||||
// Use for streaming: call whisper_vad_reset_state() between utterances.
|
||||
WHISPER_API bool whisper_vad_detect_speech_no_reset(
|
||||
struct whisper_vad_context * vctx,
|
||||
const float * samples,
|
||||
int n_samples);
|
||||
|
||||
// Reset LSTM hidden/cell states to zero.
|
||||
WHISPER_API void whisper_vad_reset_state(struct whisper_vad_context * vctx);
|
||||
|
||||
WHISPER_API int whisper_vad_n_probs(struct whisper_vad_context * vctx);
|
||||
WHISPER_API float * whisper_vad_probs (struct whisper_vad_context * vctx);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user