[FFmpeg-devel] [PATCH] avfilter/buffersrc: stop passing AV_NOPTS_VALUE on EOF
Niklas Haas
ffmpeg at haasn.xyz
Thu Jun 15 18:40:31 EEST 2023
On Thu, 15 Jun 2023 17:17:41 +0200 Paul B Mahol <onemda at gmail.com> wrote:
> Attached.
> From 88fbb2fbfd2bb7cb3474d54cb197ee42b1404532 Mon Sep 17 00:00:00 2001
> From: Paul B Mahol <onemda at gmail.com>
> Date: Thu, 15 Jun 2023 17:15:44 +0200
> Subject: [PATCH] avfilter/buffersrc: stop passing AV_NOPTS_VALUE on EOF
>
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
> libavfilter/buffersrc.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
> index 612541b803..ea50713701 100644
> --- a/libavfilter/buffersrc.c
> +++ b/libavfilter/buffersrc.c
> @@ -61,6 +61,7 @@ typedef struct BufferSourceContext {
> AVChannelLayout ch_layout;
>
> int eof;
> + int64_t last_pts;
> } BufferSourceContext;
>
> #define CHECK_VIDEO_PARAM_CHANGE(s, c, width, height, format, pts)\
> @@ -191,10 +192,12 @@ FF_ENABLE_DEPRECATION_WARNINGS
> s->nb_failed_requests = 0;
>
> if (!frame)
> - return av_buffersrc_close(ctx, AV_NOPTS_VALUE, flags);
> + return av_buffersrc_close(ctx, s->last_pts, flags);
> if (s->eof)
> return AVERROR(EINVAL);
>
> + s->last_pts = frame->pts + frame->duration;
> +
> refcounted = !!frame->buf[0];
>
> if (!(flags & AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT)) {
> --
> 2.39.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
Confirming that this fixes a bug I was encountering.
More information about the ffmpeg-devel
mailing list