mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
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
This commit is contained in:
parent
1a2c06a81c
commit
9d417815ab
1 changed files with 5 additions and 4 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue