From: John Stebbins Date: Thu, 31 May 2018 17:27:35 +0000 (-0700) Subject: avfilter: fix flushing final frame X-Git-Tag: 1.1.1~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=68c5a200007a843b630bc693ad4b8334ec9cf215;p=handbrake avfilter: fix flushing final frame Fixes https://github.com/HandBrake/HandBrake/issues/1357 (cherry picked from commit f70380a7b1c99f919712cb69b28bfc48eeb0b83d) --- diff --git a/libhb/avfilter.c b/libhb/avfilter.c index b82621426..91b571301 100644 --- a/libhb/avfilter.c +++ b/libhb/avfilter.c @@ -406,8 +406,15 @@ static hb_buffer_t* filterFrame( hb_filter_private_t * pv, hb_buffer_t * in ) int result; hb_buffer_list_t list; - fill_frame(pv, pv->frame, in); - result = av_buffersrc_add_frame(pv->input, pv->frame); + if (in != NULL) + { + fill_frame(pv, pv->frame, in); + result = av_buffersrc_add_frame(pv->input, pv->frame); + } + else + { + result = av_buffersrc_add_frame(pv->input, NULL); + } if (result < 0) { return NULL; @@ -444,11 +451,13 @@ static int avfilter_work( hb_filter_object_t * filter, if (in->s.flags & HB_BUF_FLAG_EOF) { + hb_buffer_t * out = filterFrame(pv, NULL); hb_buffer_t * last = hb_buffer_list_tail(&pv->list); if (last != NULL && last->s.start != AV_NOPTS_VALUE) { last->s.stop = last->s.start + last->s.duration; } + hb_buffer_list_prepend(&pv->list, out); hb_buffer_list_append(&pv->list, in); *buf_out = hb_buffer_list_clear(&pv->list); *buf_in = NULL;