If get_filtered_video_frame failed above, tb might not be
initialized at all, so don't scale using it.

This fixes cases where avplay could crash if aborting
avformat_find_stream_info with ctrl+c.
---
 avplay.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/avplay.c b/avplay.c
index d9c1786..d1cf53d 100644
--- a/avplay.c
+++ b/avplay.c
@@ -1792,15 +1792,15 @@ static int video_thread(void *arg)
         ret = get_filtered_video_frame(filt_out, frame, &picref, &tb);
         if (picref) {
             pts_int = picref->pts;
             pos     = picref->pos;
             frame->opaque = picref;
         }
 
-        if (av_cmp_q(tb, is->video_st->time_base)) {
+        if (ret >= 0 && av_cmp_q(tb, is->video_st->time_base)) {
             av_unused int64_t pts1 = pts_int;
             pts_int = av_rescale_q(pts_int, tb, is->video_st->time_base);
             av_dlog(NULL, "video_thread(): "
                     "tb:%d/%d pts:%"PRId64" -> tb:%d/%d pts:%"PRId64"\n",
                     tb.num, tb.den, pts1,
                     is->video_st->time_base.num, is->video_st->time_base.den, 
pts_int);
         }
-- 
1.7.9.4

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to