qtdemux: Don't overflow sample index

Don't reduce sample index if it is already at 0.
Assigning -1 to a guint32 variable causes unexpected behavior.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5751>
This commit is contained in:
Hosang Lee 2023-12-01 14:51:49 +09:00 committed by GStreamer Marge Bot
parent 890e5533ee
commit 4356d4262e

View file

@ -5020,7 +5020,12 @@ gst_qtdemux_seek_to_previous_keyframe (GstQTDemux * qtdemux)
}
/* Remember until where we want to go */
str->to_sample = str->from_sample - 1;
if (str->from_sample == 0) {
GST_LOG_OBJECT (qtdemux, "already at sample 0");
str->to_sample = 0;
} else {
str->to_sample = str->from_sample - 1;
}
/* Define our time position */
target_ts =
str->samples[k_index].timestamp + str->samples[k_index].pts_offset;