ges: Cast to signed int to compare agasint 0
authorThibault Saunier <tsaunier@igalia.com>
Thu, 9 Apr 2020 14:42:03 +0000 (10:42 -0400)
committerThibault Saunier <tsaunier@igalia.com>
Fri, 10 Apr 2020 15:12:12 +0000 (11:12 -0400)
The check made sense but we were not casting to be able to check
signess of subtraction result.

CID: 1444923

ges/ges-timeline.c

index bf0559d831f38db8ed5dd7d7467cb43d54af7a32..ab65978a656eca260426e77cf962bd496770eb70 100644 (file)
@@ -1163,12 +1163,14 @@ timeline_ripple_object (GESTimeline * timeline, GESTimelineElement * obj,
 
       timeline->priv->needs_transitions_update = FALSE;
       new_duration =
-          CLAMP (position - obj->start, 0, obj->maxduration - obj->inpoint);
+          CLAMP (GST_CLOCK_DIFF (obj->start, position), 0,
+          GST_CLOCK_TIME_IS_VALID (obj->
+              maxduration) ? GST_CLOCK_DIFF (obj->inpoint,
+              obj->maxduration) : GST_CLOCK_TIME_NONE);
       res =
           timeline_tree_ripple (timeline->priv->tree,
           (gint64) GES_TIMELINE_ELEMENT_LAYER_PRIORITY (obj) -
-          (gint64) new_layer_priority,
-          _DURATION (obj) - new_duration, obj,
+          (gint64) new_layer_priority, _DURATION (obj) - new_duration, obj,
           GES_EDGE_END, timeline->priv->snapping_distance);
       timeline->priv->needs_transitions_update = TRUE;