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
This commit is contained in:
Sebastian Dröge 2020-03-09 13:02:20 +02:00
parent 8d0fa62275
commit 8e038572cb

View file

@ -73,7 +73,13 @@ impl Caps {
pub fn fixate(&mut self) { pub fn fixate(&mut self) {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
let ptr = gst_sys::gst_caps_fixate(self.as_mut_ptr()); // See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/388
assert!(!self.is_any());
let ptr = if self.is_empty() {
gst_sys::gst_caps_new_empty()
} else {
gst_sys::gst_caps_fixate(self.as_mut_ptr())
};
self.replace_ptr(ptr); self.replace_ptr(ptr);
} }
} }