videorate: Bring all timestamp in the runtime scale when applying rate to QoS

Otherwise the timescale won't match and we might end up with totally broken
QoS events.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9013>
This commit is contained in:
Thibault Saunier 2025-05-09 15:16:33 -04:00 committed by GStreamer Marge Bot
parent 51d43529c3
commit e697fe98eb

View File

@ -1402,18 +1402,23 @@ gst_video_rate_src_event (GstBaseTransform * trans, GstEvent * event)
videorate->base_output_ts) * videorate->rate)), diff,
(GstClockTimeDiff) (diff * videorate->rate));
if (videorate->segment.rate < 0.0) {
timestamp =
(videorate->segment.stop - videorate->base_output_ts) -
((videorate->segment.stop - videorate->base_output_ts -
timestamp) * videorate->rate);
} else {
timestamp =
videorate->base_output_ts + ((timestamp -
videorate->base_output_ts) * videorate->rate);
}
diff *= videorate->rate;
GstClockTime base_rtime =
gst_segment_to_running_time (&videorate->segment, GST_FORMAT_TIME,
videorate->base_output_ts);
if (videorate->segment.rate < 0.0) {
GstClockTime stop_rtime =
gst_segment_to_running_time (&videorate->segment, GST_FORMAT_TIME,
videorate->segment.stop);
timestamp =
(stop_rtime - base_rtime) - ((stop_rtime - base_rtime -
timestamp) * videorate->rate);
if (diff < 0 && -diff > timestamp)
diff = 0;
} else {
timestamp = base_rtime + ((timestamp - base_rtime) * videorate->rate);
}
GST_OBJECT_UNLOCK (trans);
gst_event_unref (event);