summaryrefslogtreecommitdiff
path: root/libavfilter/af_loudnorm.c
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.xyz>2018-02-03 15:22:05 +0100
committerPaul B Mahol <onemda@gmail.com>2018-02-14 18:10:53 +0100
commit7c82e0f61e365296b094684fd92aea0fe05ceb93 (patch)
treedabae417a37c7f053a56e18007d2b27e54307aa4 /libavfilter/af_loudnorm.c
parentdc77e64f2d41a9a778b11afbfa8709e1ce483ef1 (diff)
downloadffmpeg-7c82e0f61e365296b094684fd92aea0fe05ceb93.tar.gz
avfilter/af_loudnorm: correctly initialize PTS
Right now, the PTS always starts out as 0, which causes problems on a seek or when inserting this filter mid-stream. Initialize it instead to AV_NOPTS_VALUE and copy the PTS from the first frame instead if this is the case.
Diffstat (limited to 'libavfilter/af_loudnorm.c')
-rw-r--r--libavfilter/af_loudnorm.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavfilter/af_loudnorm.c b/libavfilter/af_loudnorm.c
index a7f11cbe6e..314b25fa39 100644
--- a/libavfilter/af_loudnorm.c
+++ b/libavfilter/af_loudnorm.c
@@ -431,6 +431,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
av_frame_copy_props(out, in);
}
+ if (s->pts == AV_NOPTS_VALUE)
+ s->pts = in->pts;
+
out->pts = s->pts;
src = (const double *)in->data[0];
dst = (double *)out->data[0];
@@ -763,7 +766,7 @@ static int config_input(AVFilterLink *inlink)
inlink->partial_buf_size = frame_size(inlink->sample_rate, 3000);
}
- s->pts =
+ s->pts = AV_NOPTS_VALUE;
s->buf_index =
s->prev_buf_index =
s->limiter_buf_index = 0;