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/5743>
This commit is contained in:
Hosang Lee 2023-12-01 14:51:49 +09:00 committed by GStreamer Marge Bot
parent 269df73f92
commit 7bf646e5ba

View file

@ -5373,7 +5373,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;