From 43235969be2ca2e7c8a8ccfe77fbe6f17641b2a8 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Mon, 1 Oct 2018 17:25:50 -0700 Subject: [PATCH] encoding_profile: set_restriction is transfer-full not transfer-none Avoid refcounting mistakes by using the right converting functions before calling the ffi layer functions --- gstreamer-pbutils/src/encoding_profile.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gstreamer-pbutils/src/encoding_profile.rs b/gstreamer-pbutils/src/encoding_profile.rs index 1ad7d4ba4..b0dd540f1 100644 --- a/gstreamer-pbutils/src/encoding_profile.rs +++ b/gstreamer-pbutils/src/encoding_profile.rs @@ -2,6 +2,7 @@ use gst; use glib; use ffi; +use gst_ffi; use std::error; use std::fmt; @@ -96,9 +97,13 @@ impl + IsA> EncodingProfileEdit fo fn set_restriction<'a, P: Into>>(&self, restriction: P) { let restriction = restriction.into(); - let restriction = restriction.to_glib_none(); unsafe { - ffi::gst_encoding_profile_set_restriction(self.to_glib_none().0, restriction.0); + let restriction = match restriction { + Some(restriction) => restriction.to_glib_full(), + None => gst_ffi::gst_caps_new_any(), + }; + + ffi::gst_encoding_profile_set_restriction(self.to_glib_none().0, restriction); } } } @@ -279,7 +284,6 @@ fn set_common_fields(profile: &mut T, base_data: &Encodi profile.set_preset_name(base_data.preset_name); profile.set_allow_dynamic_output(base_data.allow_dynamic_output); profile.set_enabled(base_data.enabled); - profile.set_restriction(base_data.restriction); profile.set_presence(base_data.presence); }