From 2599acc681ed98b594d3c39a485a5fc25bf50310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 9 Mar 2020 13:02:20 +0200 Subject: [PATCH] gstreamer/caps: Assert on ANY caps in fixate() and work around bug in handling EMPTY caps See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/388 --- gstreamer/src/caps.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gstreamer/src/caps.rs b/gstreamer/src/caps.rs index 4e800dd38..3343c9d2d 100644 --- a/gstreamer/src/caps.rs +++ b/gstreamer/src/caps.rs @@ -72,7 +72,16 @@ impl Caps { pub fn fixate(caps: Self) -> Self { skip_assert_initialized!(); - unsafe { from_glib_full(gst_sys::gst_caps_fixate(caps.into_ptr())) } + unsafe { + // See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/388 + assert!(!caps.is_any()); + let ptr = if caps.is_empty() { + gst_sys::gst_caps_new_empty() + } else { + gst_sys::gst_caps_fixate(caps.into_ptr()) + }; + from_glib_full(ptr) + } } pub fn merge(caps: Self, other: Self) -> Self {