Commit 7c82e0f6 authored by Niklas Haas's avatar Niklas Haas Committed by Paul B Mahol

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.
parent dc77e64f
...@@ -431,6 +431,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) ...@@ -431,6 +431,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
av_frame_copy_props(out, in); av_frame_copy_props(out, in);
} }
if (s->pts == AV_NOPTS_VALUE)
s->pts = in->pts;
out->pts = s->pts; out->pts = s->pts;
src = (const double *)in->data[0]; src = (const double *)in->data[0];
dst = (double *)out->data[0]; dst = (double *)out->data[0];
...@@ -763,7 +766,7 @@ static int config_input(AVFilterLink *inlink) ...@@ -763,7 +766,7 @@ static int config_input(AVFilterLink *inlink)
inlink->partial_buf_size = frame_size(inlink->sample_rate, 3000); inlink->partial_buf_size = frame_size(inlink->sample_rate, 3000);
} }
s->pts = s->pts = AV_NOPTS_VALUE;
s->buf_index = s->buf_index =
s->prev_buf_index = s->prev_buf_index =
s->limiter_buf_index = 0; s->limiter_buf_index = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment