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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/761>
This commit is contained in:
Olivier Crête 2020-07-16 16:04:23 -04:00 committed by Olivier Crête
parent 323554a31a
commit 90ff086a43

View file

@ -705,13 +705,15 @@ gst_video_rate_push_buffer (GstVideoRate * videorate, GstBuffer * outbuf,
videorate->to_rate_denominator * GST_SECOND, videorate->to_rate_denominator * GST_SECOND,
videorate->to_rate_numerator); videorate->to_rate_numerator);
GST_BUFFER_DURATION (outbuf) = videorate->next_ts - push_ts; 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 { } else {
/* There must always be a valid duration on prevbuf if rate > 0, /* There must always be a valid duration on prevbuf if rate > 0,
* it is ensured in the transform_ip function */ * 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);
} }
} }