qtdemux: Fix seek adjustment with SNAP_AFTER flag
authorPiotr Brzeziński <piotr@centricular.com>
Mon, 20 Mar 2023 15:35:45 +0000 (16:35 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Wed, 22 Mar 2023 16:51:16 +0000 (16:51 +0000)
commit6dad5345ea387967c632159cde0515dd3ac85512
tree948e54730bea9b399f2f007caba0304ab587e399
parent6c539cbb4a11a7ba40c8ac32bfc42a3616752995
qtdemux: Fix seek adjustment with SNAP_AFTER flag

With GST_SEEK_FLAG_SNAP_AFTER present, the previous version would
adjust seek time based on the keyframe farthest away from desired_time.
This was incorrect, because we always want the *earliest* suitable keyframe
to seek to, not the last one.
With this fix, in case of the SNAP_AFTER, we now look for the closest keyframe
that can be found after desired_time. Behaviour for SNAP_BEFORE should remain
unchanged.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4251>
subprojects/gst-plugins-good/gst/isomp4/qtdemux.c