Skip to content

Commit

Permalink
avfilter: fix stop time of final filtered frame
Browse files Browse the repository at this point in the history
Muxer expects all stop times to be set.  avfilter was setting the stop
time on the last frame to AV_NOPTS_VALUE.
  • Loading branch information
jstebbins committed Sep 29, 2016
1 parent f7ff05d commit 68ee40c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libhb/avfilter.c
Expand Up @@ -393,7 +393,7 @@ static void fill_frame(hb_filter_private_t * pv,
frame->linesize[2] = buf->plane[2].stride;

frame->pts = buf->s.start;
frame->reordered_opaque = buf->s.start;
frame->reordered_opaque = buf->s.duration;
frame->width = buf->f.width;
frame->height = buf->f.height;
frame->format = buf->f.fmt;
Expand Down Expand Up @@ -431,6 +431,7 @@ static hb_buffer_t* avframe_to_buffer(hb_filter_private_t * pv, AVFrame *frame)
}
buf->s.start = av_rescale_q(frame->pts, pv->out_time_base,
(AVRational){1, 90000});
buf->s.duration = frame->reordered_opaque;

if (frame->top_field_first)
{
Expand Down Expand Up @@ -498,6 +499,11 @@ static int avfilter_work( hb_filter_object_t * filter,

if (in->s.flags & HB_BUF_FLAG_EOF)
{
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_append(&pv->list, in);
*buf_out = hb_buffer_list_clear(&pv->list);
*buf_in = NULL;
Expand Down

0 comments on commit 68ee40c

Please sign in to comment.