mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-06-04 05:57:49 +02:00
avfilter/af_dynaudnorm: improve EOF timestamp precision
This commit is contained in:
parent
19802d170a
commit
f78d0f67be
@ -706,7 +706,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
|||||||
cqueue_dequeue(s->is_enabled, &is_enabled);
|
cqueue_dequeue(s->is_enabled, &is_enabled);
|
||||||
|
|
||||||
amplify_frame(s, out, is_enabled > 0.);
|
amplify_frame(s, out, is_enabled > 0.);
|
||||||
s->pts = out->pts + out->nb_samples;
|
s->pts = out->pts + av_rescale_q(out->nb_samples, av_make_q(1, outlink->sample_rate),
|
||||||
|
outlink->time_base);
|
||||||
ret = ff_filter_frame(outlink, out);
|
ret = ff_filter_frame(outlink, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -749,15 +750,17 @@ static int flush_buffer(DynamicAudioNormalizerContext *s, AVFilterLink *inlink,
|
|||||||
static int flush(AVFilterLink *outlink)
|
static int flush(AVFilterLink *outlink)
|
||||||
{
|
{
|
||||||
AVFilterContext *ctx = outlink->src;
|
AVFilterContext *ctx = outlink->src;
|
||||||
|
AVFilterLink *inlink = ctx->inputs[0];
|
||||||
DynamicAudioNormalizerContext *s = ctx->priv;
|
DynamicAudioNormalizerContext *s = ctx->priv;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (!cqueue_empty(s->gain_history_smoothed[0])) {
|
if (!cqueue_empty(s->gain_history_smoothed[0])) {
|
||||||
ret = flush_buffer(s, ctx->inputs[0], outlink);
|
ret = flush_buffer(s, inlink, outlink);
|
||||||
} else if (s->queue.available) {
|
} else if (s->queue.available) {
|
||||||
AVFrame *out = ff_bufqueue_get(&s->queue);
|
AVFrame *out = ff_bufqueue_get(&s->queue);
|
||||||
|
|
||||||
s->pts = out->pts + out->nb_samples;
|
s->pts = out->pts + av_rescale_q(out->nb_samples, av_make_q(1, outlink->sample_rate),
|
||||||
|
outlink->time_base);
|
||||||
ret = ff_filter_frame(outlink, out);
|
ret = ff_filter_frame(outlink, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user