mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-28 20:53:54 +02:00
lavfi/vf_libplacebo: only drain actually used PTS
When combining multiple inputs, the output PTS may be less than the PTS of the input. In this case, the current's code assumption of always draining one value from the FIFO is incorrect. Replace by a smarter function which drains only those PTS values that were actually consumed.
This commit is contained in:
parent
502b699a50
commit
6c41c3f928
@ -971,6 +971,13 @@ static int handle_input(AVFilterContext *ctx, LibplaceboInput *input)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void drain_input_pts(LibplaceboInput *in, int64_t until)
|
||||||
|
{
|
||||||
|
int64_t pts;
|
||||||
|
while (av_fifo_peek(in->out_pts, &pts, 1, 0) >= 0 && pts <= until)
|
||||||
|
av_fifo_drain2(in->out_pts, 1);
|
||||||
|
}
|
||||||
|
|
||||||
static int libplacebo_activate(AVFilterContext *ctx)
|
static int libplacebo_activate(AVFilterContext *ctx)
|
||||||
{
|
{
|
||||||
int ret, retry = 0;
|
int ret, retry = 0;
|
||||||
@ -1023,8 +1030,7 @@ static int libplacebo_activate(AVFilterContext *ctx)
|
|||||||
ff_inlink_request_frame(in->link);
|
ff_inlink_request_frame(in->link);
|
||||||
return 0;
|
return 0;
|
||||||
case PL_QUEUE_OK:
|
case PL_QUEUE_OK:
|
||||||
if (!s->fps.num)
|
drain_input_pts(in, out_pts);
|
||||||
av_fifo_drain2(in->out_pts, 1);
|
|
||||||
return output_frame(ctx, out_pts);
|
return output_frame(ctx, out_pts);
|
||||||
case PL_QUEUE_ERR:
|
case PL_QUEUE_ERR:
|
||||||
return AVERROR_EXTERNAL;
|
return AVERROR_EXTERNAL;
|
||||||
|
Loading…
Reference in New Issue
Block a user