danbev commited on
Commit
60ecd84
·
unverified ·
1 Parent(s): 5257653

whisper : clear result_all if vad_samples is empty (#3262)

Browse files

This commit clears the results_all vector no VAD segments are found.

The motivation for this is that this would normally be done by
`whisper_full_with_state` but when no VAD segments are detected this
current implementation does not call that function and hence the vector
does not get reset. This can lead to issues in applications like the
server example where it will incorrectly process the old results.

Resolves: https://github.com/ggml-org/whisper.cpp/issues/3250

Files changed (1) hide show
  1. src/whisper.cpp +1 -0
src/whisper.cpp CHANGED
@@ -7724,6 +7724,7 @@ int whisper_full(
7724
  return -1;
7725
  }
7726
  if (vad_samples.empty()) {
 
7727
  return 0;
7728
  }
7729
  samples = vad_samples.data();
 
7724
  return -1;
7725
  }
7726
  if (vad_samples.empty()) {
7727
+ ctx->state->result_all.clear();
7728
  return 0;
7729
  }
7730
  samples = vad_samples.data();