1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +02:00

avfilter/af_silenceremove: fix stop_silence handling

This commit is contained in:
Paul B Mahol
2021-09-08 15:37:36 +02:00
parent 8a42ee6697
commit 38ab20e591

View File

@@ -792,17 +792,20 @@ silence_copy:
} else if (!threshold) { } else if (!threshold) {
for (j = 0; j < outlink->channels; j++) { for (j = 0; j < outlink->channels; j++) {
s->update(s, in, j, nb_samples_read); s->update(s, in, j, nb_samples_read);
if (s->stop_silence) { if (s->stop_silence)
s->copy(s, s->stop_silence_hold, in, j, s->stop_silence_offset, nb_samples_read); s->copy(s, s->stop_silence_hold, in, j, s->stop_silence_offset, nb_samples_read);
s->stop_silence_end = FFMIN(s->stop_silence_end + 1, s->stop_silence);
if (s->stop_silence_offset >= s->stop_silence) {
s->stop_silence_offset = 0;
}
}
s->copy(s, s->stop_holdoff, in, j, s->stop_holdoff_end, nb_samples_read); s->copy(s, s->stop_holdoff, in, j, s->stop_holdoff_end, nb_samples_read);
} }
if (s->stop_silence) {
s->stop_silence_offset++;
s->stop_silence_end = FFMIN(s->stop_silence_end + 1, s->stop_silence);
if (s->stop_silence_offset >= s->stop_silence) {
s->stop_silence_offset = 0;
}
}
s->window_offset++; s->window_offset++;
if (s->window_offset >= s->window_duration) if (s->window_offset >= s->window_duration)
s->window_offset = 0; s->window_offset = 0;