mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-04 22:48:54 +00:00
videorate: Avoid overflow in calculations
base_ts and next_end_ts are both guint64. Use explicit check to avoid "negative" timestamps (which would overflow, not be negative). Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8286>
This commit is contained in:
parent
84f995dd90
commit
344ef36b5a
1 changed files with 6 additions and 2 deletions
|
@ -1921,8 +1921,12 @@ gst_video_rate_transform_ip (GstBaseTransform * trans, GstBuffer * buffer)
|
||||||
|
|
||||||
next_ts = videorate->base_ts - (
|
next_ts = videorate->base_ts - (
|
||||||
(videorate->base_ts - next_ts) * videorate->rate);
|
(videorate->base_ts - next_ts) * videorate->rate);
|
||||||
next_end_ts = videorate->base_ts - (MAX (0,
|
if (videorate->base_ts > next_end_ts)
|
||||||
(videorate->base_ts - next_end_ts)) * videorate->rate);
|
next_end_ts =
|
||||||
|
videorate->base_ts - ((videorate->base_ts -
|
||||||
|
next_end_ts) * videorate->rate);
|
||||||
|
else
|
||||||
|
next_end_ts = videorate->base_ts;
|
||||||
|
|
||||||
diff1 = ABSDIFF (prev_endtime, next_end_ts);
|
diff1 = ABSDIFF (prev_endtime, next_end_ts);
|
||||||
diff2 = ABSDIFF (in_endtime, next_end_ts);
|
diff2 = ABSDIFF (in_endtime, next_end_ts);
|
||||||
|
|
Loading…
Reference in a new issue