From 9d417815abec6b96b952d162b8eb2a1a2c2b4f4f Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Thu, 19 Jun 2014 13:35:23 +0200 Subject: [PATCH] vaapipostproc: don't crash with dynamic framerate (0/1). Avoid reaching an assert if dynamic framerates (0/1) are used. One way to solve this problem is to just stick field_duration to zero. However, this means that, in presence of interlaced streams, the very first field will never be displayed if precise presentation timestamps are honoured. https://bugzilla.gnome.org/show_bug.cgi?id=729604 --- gst/vaapi/gstvaapipostproc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gst/vaapi/gstvaapipostproc.c b/gst/vaapi/gstvaapipostproc.c index 73e1ea3..aa0cb98 100644 --- a/gst/vaapi/gstvaapipostproc.c +++ b/gst/vaapi/gstvaapipostproc.c @@ -522,7 +522,8 @@ gst_vaapipostproc_process_vpp(GstBaseTransform *trans, GstBuffer *inbuf, /* Reset deinterlacing state when there is a discontinuity */ if (prev_buf && (prev_pts = GST_BUFFER_TIMESTAMP(prev_buf)) != pts) { const GstClockTimeDiff pts_diff = GST_CLOCK_DIFF(prev_pts, pts); - if (pts_diff < 0 || pts_diff > postproc->field_duration * 2) + if (pts_diff < 0 || (postproc->field_duration > 0 && + pts_diff > postproc->field_duration * 2)) ds_reset(ds); } } @@ -823,9 +824,9 @@ gst_vaapipostproc_update_sink_caps(GstVaapiPostproc *postproc, GstCaps *caps, deinterlace = is_deinterlace_enabled(postproc, &vi); if (deinterlace) postproc->flags |= GST_VAAPI_POSTPROC_FLAG_DEINTERLACE; - postproc->field_duration = gst_util_uint64_scale( - GST_SECOND, GST_VIDEO_INFO_FPS_D(&vi), - (1 + deinterlace) * GST_VIDEO_INFO_FPS_N(&vi)); + postproc->field_duration = GST_VIDEO_INFO_FPS_N(&vi) > 0 ? + gst_util_uint64_scale(GST_SECOND, GST_VIDEO_INFO_FPS_D(&vi), + (1 + deinterlace) * GST_VIDEO_INFO_FPS_N(&vi)) : 0; postproc->is_raw_yuv = GST_VIDEO_INFO_IS_YUV(&vi); return TRUE; -- 2.7.4