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.