I want send back received VideoStream (webrtcbin)

kenji tanaka gtk2kritto at gmail.com
Wed May 10 04:11:05 UTC 2023


I want to decode the VideoStream received by webrtcbin and send the
re-encoded VideoStream back to the sender by webrtcbin.
But I get loop detected. Is it possible to build a pipeline that avoids
loops?
By the way, I am using C# (GstSharp) to write the code.
    void OnIncomingDecodebinStream(object o, SignalArgs args)
    {
        var pad = (Pad)args.Args[0];
        if (!pad.HasCurrentCaps)
        {
            Console.WriteLine($"{pad.Name} has no caps, ignoring");
            return;
        }

        var caps = pad.CurrentCaps;
        Assert(!caps.IsEmpty);
        Structure s = caps[0];
        var name = s.Name;
        if (name.StartsWith("video"))
        {
            var q = ElementFactory.Make("queue");
            var conv = ElementFactory.Make("videoconvert");
            var encoder = ElementFactory.Make("nvh264enc");
            var payload = ElementFactory.Make("rtph264pay");

            //var sink = ElementFactory.Make("autovideosink");
            pipe.Add(q, conv, encoder, payload);
            pipe.SyncChildrenStates();
            pad.Link(q.GetStaticPad("sink"));
            payload.GetStaticPad("src").Link(webrtc.GetStaticPad("sink"));
            Element.Link(q, conv, encoder, payload, webrtc);
        }
        //else if (name.StartsWith("audio"))
        //{
        //    var q = ElementFactory.Make("queue");
        //    var conv = ElementFactory.Make("audioconvert");
        //    var resample = ElementFactory.Make("audioresample");
        //    //var sink = ElementFactory.Make("autoaudiosink");
        //    pipe.Add(q, conv, resample, webrtc);
        //    pipe.SyncChildrenStates();
        //    pad.Link(q.GetStaticPad("sink"));
        //    Element.Link(q, conv, resample, webrtc);
        //}
    }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20230510/6a3dbfc1/attachment.htm>


More information about the gstreamer-devel mailing list