RTP & RTCP restream using rtpbin.
stproj
smpalasis at gmail.com
Thu Oct 20 10:14:58 UTC 2016
Sebastian Dröge-3 wrote
> On Wed, 2016-10-19 at 05:15 -0700, stproj wrote:
>> Greetings,
>>
>> I'm trying to built a streaming application that involves streaming and
>> restreaming to different machines the same source and daisy chain them.
>>
>> What i want to do for starters, is to make rtpbin both a receiver and a
>> transmitter of an rtp stream, and its respective rtcp streams. Below, im
>> providing the part where I'm trying to link rtpsrc to rtpbin and rtpbin
>> to
>> rtpsink, but it doesn't work (can't link rtpbin to rtpsink). If u have
>> any
>> suggestion on how should i move pls share the knowledge!!
>>
>> Thank you in advance,
>> S.
>>
>>
>>
>> /* the rtpbin element */
>> rtpbin = gst_element_factory_make ("rtpbin", "rtpbin");
>> g_assert (rtpbin);
>>
>> gst_bin_add (GST_BIN (pipeline), rtpbin);
>>
>> /* now link all to the rtpbin, start by getting an RTP sinkpad for
>> session
>> 0 */
>> srcpad = gst_element_get_static_pad (rtpsrc, "src");
>> sinkpad = gst_element_get_request_pad (rtpbin, "recv_rtp_sink_0");
>> lres = gst_pad_link (srcpad, sinkpad);
>> g_assert (lres == GST_PAD_LINK_OK);
>> gst_object_unref (srcpad);
>>
>> /* get the RTP srcpad that was created when we requested the sinkpad
>> above
>> and
>> * link it to the rtpsink sinkpad*/
>> srcpad = gst_element_get_request_pad (rtpbin, "send_rtp_src_0");
>> sinkpad = gst_element_get_static_pad (rtpsink, "sink");
>> if (gst_pad_link (srcpad,sinkpad) != GST_PAD_LINK_OK)
>> g_error ("Failed to link rtpbin to rtpsink");
>
> "send_rtp_src_%u" is a sometimes pad on rtpbin, not a request pad. It
> will appear (check the pad-added signal) at some point and then you can
> link it.
>
> You probably also want "recv_rtp_src_%u_%u_%u", which is the pad that
> is created (also later, see pad-added) from "recv_rtp_sink_%u".
>
> --
> Sebastian Dröge, Centricular Ltd · http://www.centricular.com
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at .freedesktop
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
> signature.asc (949 bytes)
> <http://gstreamer-devel.966125.n4.nabble.com/attachment/4680135/0/signature.asc>
Hello Sebastian,
Thank you for your reply. You are right, with on_pad_added_cb i can link
rtpbin to rtpsink and relay the rtpstream.
I now have the same problem with building the rtcp src/sink for this
particular session. Do you think that i can rename the new_pad or should i
extract the %u_%u_%u part from the string in order to make it the same for
the rtcpsrcpad & rtcpsinkpads.
Im providing the on_pad_added_cb.
static void
pad_added_cb (GstElement * rtpbin, GstPad * new_pad, GstElement * sink)
{
GstPad *sinkpad, *srcpad;
GstPadLinkReturn lres;
g_print ("new payload on pad: %s\n", GST_PAD_NAME (new_pad));
sinkpad = gst_element_get_static_pad (sink, "sink");
g_assert (sinkpad);
lres = gst_pad_link (new_pad, sinkpad);
g_assert (lres == GST_PAD_LINK_OK);
gst_object_unref (sinkpad);
}
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/RTP-RTCP-restream-using-rtpbin-tp4680123p4680143.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list