summaryrefslogtreecommitdiff
path: root/gst/gstevent.c
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2018-06-11 10:22:39 +0300
committerSebastian Dröge <sebastian@centricular.com>2018-06-18 10:31:16 +0300
commit8f496b7392185dd8fe1eec22b30dab7f7d481627 (patch)
tree8b82a289ce00de2b1932c6ba343564eb2714f1da /gst/gstevent.c
parent1908daf29caa15b08ad629ce9dd7486927090da0 (diff)
downloadgstreamer-8f496b7392185dd8fe1eec22b30dab7f7d481627.tar.gz
event: Unset SNAP flags when creating a new seek event without KEY_UNIT flag
The SNAP flags only make sense in combination with the KEY_UNIT flag, and without they expose all kinds of unexpected behaviour in various elements that don't expect this from happening. Also warn if this ever happens. https://bugzilla.gnome.org/show_bug.cgi?id=796558
Diffstat (limited to 'gst/gstevent.c')
-rw-r--r--gst/gstevent.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gst/gstevent.c b/gst/gstevent.c
index a47d573105..fae950c32d 100644
--- a/gst/gstevent.c
+++ b/gst/gstevent.c
@@ -1268,6 +1268,18 @@ gst_event_new_seek (gdouble rate, GstFormat format, GstSeekFlags flags,
g_return_val_if_fail (rate != 0.0, NULL);
+ /* SNAP flags only make sense in combination with the KEYUNIT flag. Warn
+ * and unset the SNAP flags if they're set without the KEYUNIT flag */
+ if (!(flags & GST_SEEK_FLAG_KEY_UNIT) &&
+ (flags & (GST_SEEK_FLAG_SNAP_BEFORE | GST_SEEK_FLAG_SNAP_AFTER |
+ GST_SEEK_FLAG_SNAP_NEAREST))) {
+ g_warning ("SNAP seeks only work in combination with the KEY_UNIT "
+ "flag, ignoring SNAP flags");
+ flags &=
+ ~(GST_SEEK_FLAG_SNAP_BEFORE | GST_SEEK_FLAG_SNAP_AFTER |
+ GST_SEEK_FLAG_SNAP_NEAREST);
+ }
+
if (format == GST_FORMAT_TIME) {
GST_CAT_INFO (GST_CAT_EVENT,
"creating seek rate %lf, format TIME, flags %d, "