I want send back received VideoStream (webrtcbin)
Vivia Nikolaidou
n.vivia at gmail.com
Wed May 10 11:04:37 UTC 2023
Hi,
Indeed, the GStreamer pipeline cannot contain loops. I would suggest
that you use an appsink after decoding (ideally raw video/audio, it
will be easier) and an appsrc to take back the data, encode it, and
feed it back to the webrtcbin. You might also want to have pad offsets
that modify the buffer timestamps, so that webrtcbin doesn't reject
everything for being too late.
On Wed, 10 May 2023 at 04:11, kenji tanaka via gstreamer-devel
<gstreamer-devel at lists.freedesktop.org> wrote:
>
> 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);
> //}
> }
More information about the gstreamer-devel
mailing list