From 90ff086a4372ab5ad6374544dfbefcb23ff66a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= Date: Thu, 16 Jul 2020 16:04:23 -0400 Subject: [PATCH] videorate: Assert on invalid result from internal code Letting this through instead results in an infinite loop where the exact same buffer gets pushed out ad infinitum. Part-of: --- gst/videorate/gstvideorate.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gst/videorate/gstvideorate.c b/gst/videorate/gstvideorate.c index 567b6c00b1..a80453fc23 100644 --- a/gst/videorate/gstvideorate.c +++ b/gst/videorate/gstvideorate.c @@ -705,13 +705,15 @@ gst_video_rate_push_buffer (GstVideoRate * videorate, GstBuffer * outbuf, videorate->to_rate_denominator * GST_SECOND, videorate->to_rate_numerator); GST_BUFFER_DURATION (outbuf) = videorate->next_ts - push_ts; - } else if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DURATION (outbuf))) { - videorate->next_ts = - GST_BUFFER_PTS (outbuf) + GST_BUFFER_DURATION (outbuf); } else { /* There must always be a valid duration on prevbuf if rate > 0, * it is ensured in the transform_ip function */ - GST_FIXME_OBJECT (videorate, "No buffer duration known"); + g_assert (GST_BUFFER_PTS_IS_VALID (outbuf)); + g_assert (GST_BUFFER_DURATION_IS_VALID (outbuf)); + g_assert (GST_BUFFER_DURATION (outbuf) != 0); + + videorate->next_ts + = GST_BUFFER_PTS (outbuf) + GST_BUFFER_DURATION (outbuf); } }