diff --git a/libavfilter/af_silenceremove.c b/libavfilter/af_silenceremove.c index 755ed10bd0..865df4d13a 100644 --- a/libavfilter/af_silenceremove.c +++ b/libavfilter/af_silenceremove.c @@ -442,4 +442,5 @@ const AVFilter ff_af_silenceremove = { FILTER_SAMPLEFMTS(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), .process_command = ff_filter_process_command, + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, }; diff --git a/libavfilter/silenceremove_template.c b/libavfilter/silenceremove_template.c index 143d399f9e..e07a615ae7 100644 --- a/libavfilter/silenceremove_template.c +++ b/libavfilter/silenceremove_template.c @@ -318,9 +318,10 @@ static void fn(filter_start)(AVFilterContext *ctx, if (s->start_sample_count > start_duration) { s->start_found_periods++; if (s->start_found_periods >= start_periods) { - fn(flush)(dst, start, s->start_queue_pos, nb_channels, - s->start_silence_count, start_nb_samples, - &out_nb_samples); + if (!ctx->is_disabled) + fn(flush)(dst, start, s->start_queue_pos, nb_channels, + s->start_silence_count, start_nb_samples, + &out_nb_samples); s->start_silence_count = 0; s->start_found_periods = -1; } @@ -329,7 +330,7 @@ static void fn(filter_start)(AVFilterContext *ctx, } skip: - if (s->start_found_periods < 0) { + if (s->start_found_periods < 0 || ctx->is_disabled) { const int dst_pos = out_nb_samples * nb_channels; for (int ch = 0; ch < nb_channels; ch++) dst[dst_pos + ch] = start[start_pos + ch]; @@ -401,7 +402,7 @@ static void fn(filter_stop)(AVFilterContext *ctx, if (restart && !stop_thres) s->stop_found_periods = 0; - if (s->stop_found_periods >= 0) { + if (s->stop_found_periods >= 0 || ctx->is_disabled) { if (s->found_nonsilence) { s->stop_sample_count += stop_thres; s->stop_sample_count *= stop_thres; @@ -424,7 +425,7 @@ static void fn(filter_stop)(AVFilterContext *ctx, s->stop_sample_count = 0; } - if (s->stop_found_periods >= 0) { + if (s->stop_found_periods >= 0 || ctx->is_disabled) { const int dst_pos = out_nb_samples * nb_channels; for (int ch = 0; ch < nb_channels; ch++) dst[dst_pos + ch] = stop[stop_pos + ch];