Gst-plugins-rs WhipClientSink causing errors in rust pipeline

I’m trying to use gstreamer in a rust program of mine, but I have not been able to get the whipclientsink from the gst-plugins-rs package to work. I’m on linux, but any time I run this code:

use anyhow::Error;
use gstreamer::{prelude::*, Element, ElementFactory, Pipeline, State};
use gstrswebrtc::signaller::Signallable;


fn main() -> Result<(), Error> {
    gstreamer::init()?;

    let pipeline = Pipeline::with_name("rstp-pipeline");

    // let source = ElementFactory::make("videotestsrc")
    let source = ElementFactory::make("videotestsrc")
        .build().unwrap();

    let convert = ElementFactory::make("x264enc")
        .build().unwrap();

    let whipsink = gstreamer::ElementFactory::make("whipclientsink")
        .name("whip-sink_123059")
        // .property("signaller::whip-endpoint", &format!("http://localhost:{}/whip_sink/{}", 8889, "mystream"))
        .build()?;
    // pipeline.add_many([&whipsink])?;
    let signaller = whipsink.property::<Signallable>("signaller");


    pipeline.add_many([&source, &convert]).unwrap();

    Element::link_many([&source, &convert, &whipsink]).unwrap();

    pipeline.set_state(State::Playing).unwrap();

    println!("Success!");

    Ok(())
}

I get this error on the line for the let signaller cast:

assertion `left == right` failed: Type GstRSWebRTCSignallableIface has already been registered

even though I’m not trying to register anything myself. I have the base, good, bad, ugly, and -rs plugin libraries installed, and also got this error when trying to whipsink.dynamic_cast_ref::<gstrswebrtc::webrtcsink::WhipWebRTCSink> except the type that was already registered was GSTWhipWebRTCSink instead. Is this something I’m doing wrong? Is there an issue with the library? I’ve spent probably 5-6 hours trying to get this to work.

If I remove the let signaller = line, it compiles and runs without error, but I’m not able to specify the Whip server to make it actually stream anywhere.

That sounds like you have compiled a static version of the whip element into your application and also have a dynamically loaded whip plugin. You can only have one.

That makes a lot of sense.

So it sounds like the gst-rs-webrtc rust library is trying to register the types that were already dynamically registered with the gst-plugins-rs library. Because I’m trying to write code that uses the rust library, I think I want to just the library’s declaration of the elements.

Is there a standard api that plugin libraries use to register themselves? The gst-rs-webrtc docs are broken and don’t build, and if I remove the gst-plugins-rs library, it errors on make("whipclientsink") so I’m assuming there needs to be a static registering step before the ElementFactory. Either that, or I might be able to just instantiate a WhipWebRTCSink and add it to the pipeline directly.

To anyone who (hopefully) finds this post in the future. I built the gstrswebrtc docs on my machine (which had the gstreamer libs the build process expected) and discovered there is a

gstrswebrtc::plugin_register_static()

function exported at the top level. So per ystreet00, remove the gst-plugins-rs library from your system, and instead run that rust code right after your gstreamer::init() call, and your code will compile and run.