From 5e44b3b8e054472ef2cedb5bc1cf17e44a76f2ee Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Sun, 25 Feb 2024 04:26:21 +1100 Subject: [PATCH] gstsegment: Don't use g_return_val_if_fail() Don't use g_return_val_if_fail() to catch the open-ended segment or empty segment cases in gst_segment_to_running_time_full() g_return_val_if_fail() is for programmer errors, and can be compiled out with a flag. Part-of: --- subprojects/gstreamer/gst/gstsegment.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subprojects/gstreamer/gst/gstsegment.c b/subprojects/gstreamer/gst/gstsegment.c index 72f8db1fe7..e2ec99a3f3 100644 --- a/subprojects/gstreamer/gst/gstsegment.c +++ b/subprojects/gstreamer/gst/gstsegment.c @@ -770,8 +770,8 @@ gst_segment_to_running_time_full (const GstSegment * segment, GstFormat format, stop = segment->start + segment->duration; /* cannot continue if no stop position set or invalid offset */ - g_return_val_if_fail (stop != -1, 0); - g_return_val_if_fail (stop >= offset, 0); + if (stop == -1 || stop < offset) + return 0; stop -= offset;