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: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1158>
This commit is contained in:
Sebastian Dröge 2022-11-21 13:43:22 +02:00
parent 1087b63ac4
commit 40143109da

View file

@ -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;