From 3da927a8562b212061d72bec1028c864801b20a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 21 Nov 2022 13:43:22 +0200 Subject: [PATCH] gstreamer: Fix sticky event ordering for instant-rate-change The event type for instant-rate-change events was poorly chosen, leading to them being re-sent too late and even after EOS. See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3387 Part-of: --- gstreamer/src/event.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gstreamer/src/event.rs b/gstreamer/src/event.rs index 358a21fd6..195c33a1a 100644 --- a/gstreamer/src/event.rs +++ b/gstreamer/src/event.rs @@ -112,8 +112,14 @@ impl PartialOrd for EventType { return None; } - let v1 = self.into_glib() as u32; - let v2 = other.into_glib() as u32; + // See gst_event_type_to_sticky_ordering() from 1.22 + let fixup_event_ordering = |v| match v { + ffi::GST_EVENT_INSTANT_RATE_CHANGE => ffi::GST_EVENT_SEGMENT as u32 + 1, + _ => v as u32, + }; + + let v1 = fixup_event_ordering(self.into_glib()); + let v2 = fixup_event_ordering(other.into_glib()); let stream_start = ffi::GST_EVENT_STREAM_START as u32; let segment = ffi::GST_EVENT_SEGMENT as u32;