ggerganov commited on
Commit
d5315cd
·
unverified ·
1 Parent(s): 37575fb

ref #48 : clear results at the start of whisper_full

Browse files

This way, even if the input audio is empty, the previous results will be
removed.

Files changed (1) hide show
  1. whisper.cpp +6 -5
whisper.cpp CHANGED
@@ -2314,6 +2314,12 @@ int whisper_full(
2314
  struct whisper_full_params params,
2315
  const float * samples,
2316
  int n_samples) {
 
 
 
 
 
 
2317
  // compute log mel spectrogram
2318
  if (whisper_pcm_to_mel(ctx, samples, n_samples, params.n_threads) != 0) {
2319
  fprintf(stderr, "%s: failed to compute log mel spectrogram\n", __func__);
@@ -2344,11 +2350,6 @@ int whisper_full(
2344
  }
2345
  }
2346
 
2347
- auto & result_all = ctx->result_all;
2348
- auto & result_cur = ctx->result_cur;
2349
-
2350
- result_all.clear();
2351
-
2352
  int progress_prev = 0;
2353
  int progress_step = 5;
2354
 
 
2314
  struct whisper_full_params params,
2315
  const float * samples,
2316
  int n_samples) {
2317
+ // clear old results
2318
+ auto & result_all = ctx->result_all;
2319
+ auto & result_cur = ctx->result_cur;
2320
+
2321
+ result_all.clear();
2322
+
2323
  // compute log mel spectrogram
2324
  if (whisper_pcm_to_mel(ctx, samples, n_samples, params.n_threads) != 0) {
2325
  fprintf(stderr, "%s: failed to compute log mel spectrogram\n", __func__);
 
2350
  }
2351
  }
2352
 
 
 
 
 
 
2353
  int progress_prev = 0;
2354
  int progress_step = 5;
2355