From: Georgi Gerganov Date: Sat, 15 Oct 2022 06:55:28 +0000 (+0300) Subject: ref #48 : clear results at the start of whisper_full X-Git-Tag: upstream/1.7.4~1957 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=0ad085f5e88576034adc871600da296ff8016803;p=pkg%2Fggml%2Fsources%2Fwhisper.cpp ref #48 : clear results at the start of whisper_full This way, even if the input audio is empty, the previous results will be removed. --- diff --git a/whisper.cpp b/whisper.cpp index a5f79d25..b984c460 100644 --- a/whisper.cpp +++ b/whisper.cpp @@ -2314,6 +2314,12 @@ int whisper_full( struct whisper_full_params params, const float * samples, int n_samples) { + // clear old results + auto & result_all = ctx->result_all; + auto & result_cur = ctx->result_cur; + + result_all.clear(); + // compute log mel spectrogram if (whisper_pcm_to_mel(ctx, samples, n_samples, params.n_threads) != 0) { fprintf(stderr, "%s: failed to compute log mel spectrogram\n", __func__); @@ -2344,11 +2350,6 @@ int whisper_full( } } - auto & result_all = ctx->result_all; - auto & result_cur = ctx->result_cur; - - result_all.clear(); - int progress_prev = 0; int progress_step = 5;