mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
ges-timeline: Properly calculate absolute diff of two unsigned integers
CID 1394491.
This commit is contained in:
parent
d9ab6f14e8
commit
f536db2b71
1 changed files with 8 additions and 2 deletions
|
@ -1300,14 +1300,20 @@ ges_timeline_snap_position (GESTimeline * timeline,
|
||||||
GESTrackElement *tmp_trackelement =
|
GESTrackElement *tmp_trackelement =
|
||||||
g_hash_table_lookup (priv->by_object, iter_tc);
|
g_hash_table_lookup (priv->by_object, iter_tc);
|
||||||
GESContainer *tmp_container = get_toplevel_container (tmp_trackelement);
|
GESContainer *tmp_container = get_toplevel_container (tmp_trackelement);
|
||||||
|
GstClockTimeDiff diff;
|
||||||
|
|
||||||
if (tmp_container == container)
|
if (tmp_container == container)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (ABS (timecode - *iter_tc) > smallest_offset)
|
if (timecode > *iter_tc)
|
||||||
|
diff = timecode - *iter_tc;
|
||||||
|
else
|
||||||
|
diff = *iter_tc - timecode;
|
||||||
|
|
||||||
|
if (diff > smallest_offset)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
smallest_offset = ABS (timecode - *iter_tc);
|
smallest_offset = diff;
|
||||||
ret = iter_tc;
|
ret = iter_tc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue