Unexpected behaviour with Newtype and gst::pipeline
Hello.
I am having issues creating a newtype with a gst::pipeline and could really use some insight as to what is happening.
I have a video saving pipeline that I set to NULL in one callback that later is set back to PLAYING through another callback. This works fine when setting the state directly using gst::pipeline. However, I would like to create a newtype for gst::pipeline that limits the functionality to prevent possible memory leaks. I create a struct that wraps the pipeline as below:
/// Wrapper around the pipeline to prevent an accidental memory leak
#[derive(Debug)]
#[repr(transparent)]
pub struct Pipeline(
/// The gstreamer pipeline.
gst::Pipeline,
);
and change the state of the pipeline like this:
impl Pipeline {
...
pub fn set_state(&self, state: gst::State) -> Result<gst::StateChangeSuccess> {
Ok(self.0.set_state(state)?)
}
I am getting errors when trying Stop and Start the pipeline dynamically. Specifically, these are only present when restarting the pipeline using my Pipeline newtype:
0:00:07.894205774 10264 0x5585c48de0 WARN GST_PADS gstpad.c:4351:gst_pad_peer_query:<sink_pipeline_interpipesrc:src> could not send sticky events
(minimal:10264): GStreamer-CRITICAL **: 23:20:11.461: gst_mini_object_unref: assertion 'GST_MINI_OBJECT_REFCOUNT_VALUE (mini_object) > 0' failed
0:00:07.903435749 10264 0x5584cb2d30 ERROR GST_BUS gstbus.c:1075:gst_bus_remove_watch:<bus4> no bus watch was present
Is this a ref count issue or some undefined behavior with the wrapper?
Here is my attempt at a minimal example, omxvideoenc
gives some warnings but it seems to work well enough to get the point across:minimal.zip