Skip to content
This repository was archived by the owner on Oct 24, 2022. It is now read-only.

Conversation

compiaffe
Copy link
Contributor

No description provided.

@MathieuDuponchelle
Copy link
Collaborator

Hey, I'd rather not start proxying all webrtcbin and friends properties at the webrtcsink level, this can be set instead from a handler for the consumer-added signal :)

@compiaffe
Copy link
Contributor Author

compiaffe commented Jul 25, 2022

Fair enough - good to know this can be done through the consumer-added signal - this worked :)

For future reference, the code snippet looks like this:

    let sink: gst::Bin =
        gst::ElementFactory::make_with("webrtcsink", &[("display-name", &display_name)])?
            .downcast()
            .unwrap();

    let cloned_options = options.clone();
    sink.connect_closure(
        "consumer-added",
        false,
        glib::closure!(|_webrtcsink: &gst::Element,
                        consumer_identifier: &str,
                        webrtcbin: &gst::Element| {
            gst::gst_info!(CAT, "Consumer added with id: {}", consumer_identifier);

            let webrtc_ice: gst::Object = webrtcbin.try_property("ice-agent").unwrap();
            if let Some(min_rtp_port) = cloned_options.min_rtp_port {
                gst::gst_info!(CAT, "Setting min rtp port on ice-agent");
                webrtc_ice.set_property_from_value("min-rtp-port", &min_rtp_port.to_value());
            };
            if let Some(max_rtp_port) = cloned_options.max_rtp_port {
                gst::gst_info!(CAT, "Setting max rtp port on ice-agent");
                webrtc_ice.set_property_from_value("max-rtp-port", &max_rtp_port.to_value());
            };
        }),
    );

@compiaffe compiaffe closed this Jul 25, 2022
@compiaffe compiaffe deleted the add-rtp-port-range-property branch July 25, 2022 11:29
@MathieuDuponchelle
Copy link
Collaborator

@compiaffe if you feel like adding an example for the consumer-added signal that we can point to in the README be my guest btw :D

@compiaffe
Copy link
Contributor Author

Fair enough, I can do that. Would you prefer to have it as a PR that modifies the one example server in this repo or a stand-alone repo just like https://github.com/centricular/webrtcsink-custom-signaller ?

@MathieuDuponchelle
Copy link
Collaborator

Just a separate example in plugins/examples will be completely enough, that other repository is only separate in order to provide a complete boilerplate project for applications that want to implement their own SignallableObject :)

@compiaffe
Copy link
Contributor Author

FYI, still on my list of things to do.. Might not make it before October...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants