diff options
author | Paul B Mahol <onemda@gmail.com> | 2022-04-29 21:56:02 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2022-04-29 22:27:39 +0200 |
commit | 55e0b041b370b09593e5d9f02ff56409d4ce3ad7 (patch) | |
tree | 729a3475bbe301e91d4f0b944ee96382cc11ba35 /libavfilter | |
parent | 1148e5f1cca6e00f2e4bd123978ad9e6c1790198 (diff) | |
download | ffmpeg-55e0b041b370b09593e5d9f02ff56409d4ce3ad7.tar.gz |
avfilter/vf_mix: output same number of frames from input for tmix
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/vf_mix.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libavfilter/vf_mix.c b/libavfilter/vf_mix.c index 79c96e5aec..64d07bbbbb 100644 --- a/libavfilter/vf_mix.c +++ b/libavfilter/vf_mix.c @@ -415,8 +415,12 @@ static int tmix_filter_frame(AVFilterLink *inlink, AVFrame *in) if (s->nb_frames < s->nb_inputs) { s->frames[s->nb_frames] = in; s->nb_frames++; - if (s->nb_frames < s->nb_inputs) - return 0; + while (s->nb_frames < s->nb_inputs) { + s->frames[s->nb_frames] = av_frame_clone(s->frames[s->nb_frames - 1]); + if (!s->frames[s->nb_frames]) + return AVERROR(ENOMEM); + s->nb_frames++; + } } else { av_frame_free(&s->frames[0]); memmove(&s->frames[0], &s->frames[1], sizeof(*s->frames) * (s->nb_inputs - 1)); @@ -433,7 +437,7 @@ static int tmix_filter_frame(AVFilterLink *inlink, AVFrame *in) out = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!out) return AVERROR(ENOMEM); - out->pts = s->frames[0]->pts; + out->pts = s->frames[s->nb_frames - 1]->pts; td.out = out; td.in = s->frames; |