[gst-devel] gstrtpbin and rtph264depay linking problem

Tiago Katcipis katcipis at inf.ufsc.br
Mon Mar 1 13:20:24 CET 2010


On Mon, Mar 1, 2010 at 1:24 AM, Qin Chen <eric.qin.chen at gmail.com> wrote:

> Hi experts,
>
> I am trying to write a pipeline for receiving and decoding H.264 RTP
> packets. Please see the C codes below. It is basically equivalent to
> following pipeline.
>
> gst-launch -v gstrtpbin name=rtpbin                                          \
>     udpsrc caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264" \
>
>             port=5000 ! rtpbin.recv_rtp_sink_0                                \
>         rtpbin. ! rtph264depay ! ffdec_h264 ! xvimagesink                    \
>
>
> But I couldn't link gstrtpbin and rtph264depay. The error message is as
> follows:
> 0:00:00.135605335  5934  0x95aa008 INFO        GST_ELEMENT_PADS
> gstutils.c:1587:gst_element_link_pads: trying to link element
> gst-rtp-bin:(any) to element rtp-decoder:(any)
> 0:00:00.135657988  5934  0x95aa008 INFO        GST_ELEMENT_PADS
> gstelement.c:970:gst_element_get_static_pad: no such pad
> 'recv_rtp_src_%d_%d_%d' in element "gst-rtp-bin"
> 0:00:00.135679108  5934  0x95aa008 INFO        GST_ELEMENT_PADS
> gstutils.c:1208:gst_element_get_compatible_pad:<gst-rtp-bin> Could not find
> a compatible pad to link to rtp-decoder:sink
>
> Could someone give me some hints? Why I have no "recv_rtp_src_%d_%d_%d"?


http://www.gstreamer.net/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-gstrtpbin.html

as you can see the "recv_rtp_src_%d_%d_%d" pad is created dinamically, you
cant get it.

"To use GstRtpBin <gst-plugins-good-plugins-gstrtpbin.html#GstRtpBin> as an
RTP receiver, request a recv_rtp_sink_%d pad. The session number must be
specified in the pad name. Data received on the recv_rtp_sink_%d pad will be
processed in the
GstRtpSession<gst-plugins-good-plugins-gstrtpsession.html#GstRtpSession>
manager
and after being validated forwarded on
GstRtpSsrcDemux<gst-plugins-good-plugins-gstrtpssrcdemux.html#GstRtpSsrcDemux>
element.
Each RTP stream is demuxed based on the SSRC and send to a
GstRtpJitterBuffer<gst-plugins-good-plugins-gstrtpjitterbuffer.html#GstRtpJitterBuffer>.
After the packets are released from the jitterbuffer, they will be forwarded
to aGstRtpSsrcDemux<gst-plugins-good-plugins-gstrtpssrcdemux.html#GstRtpSsrcDemux>
element.
The GstRtpSsrcDemux<gst-plugins-good-plugins-gstrtpssrcdemux.html#GstRtpSsrcDemux>
element
will demux the packets based on the payload type and will create a unique
pad recv_rtp_src_%d_%d_%d on gstrtpbin with the session number, SSRC and
payload type respectively as the pad name."


> Or could someone lead me to similar examples? Thanks in advance!
>
> Regards,
>
> Qin
>
>
> static
> GstElement* construct_receiver_pipeline(void){
>     GstElement *pipeline, *gstrtpbin, *vdec, *rtpdec, *vsink;
>     GstElement *jitterbuf, *vconv;
>     GstElement *udpsrc_rtp;
>     GstCaps *caps;
>     GstPad  *pad;
>     gboolean err;
>     GstPadLinkReturn res;
>
>     //Create gstrtpbin
>     gstrtpbin = gst_element_factory_make("gstrtpbin", "gst-rtp-bin");
>     if ( !gstrtpbin ) {
>         g_printerr("Failed to create gstrtpbin\n");
>         return 0;
>     }
>     g_object_set(G_OBJECT (jitterbuf), "latency", jitter_latency, NULL);
>
>     //RTP ource initialization
>     udpsrc_rtp = gst_element_factory_make("udpsrc", "udp-udpsrc_rtp");
>     if ( !udpsrc_rtp ) {
>         g_printerr("Failed to create udpsrc\n");
>         return 0;
>     }
>     g_object_set(G_OBJECT (udpsrc_rtp), "port", rtp_port, NULL);
>     //gst_caps_new_simple and gst_element_linked_filter don't work
>     g_object_set(G_OBJECT (udpsrc_rtp), "caps",
>             gst_caps_from_string("application/x-rtp, "
>                     "clock-rate=(int)90000, "
>                     "payload=(int)96, "
>                     "media=(string)video, "
>                     "encoding-name=(string)H264"), NULL);
>
>     //Create video decoder
>     vdec = gst_element_factory_make(vdecoder, "video-decoder");
>     if ( !vdec ) {
>         g_printerr("Failed to create %s\n", vdecoder);
>         return 0;
>     }
>
>     //Choose RTP decoder according to video codec
>     rtpdecoder = g_strdup(select_rtp_decoder(vdecoder));
>     g_free(vdecoder);
>
>     //Create rtp decoder
>     rtpdec = gst_element_factory_make(rtpdecoder, "rtp-decoder");
>     if ( !rtpdec ) {
>         g_printerr("Failed to create %s\n", rtpdecoder);
>         return 0;
>     }
>
>     //Create video converter
>     vconv = gst_element_factory_make("ffmpegcolorspace",
> "video-converter");
>     if ( !vconv ) {
>         g_printerr("Failed to create ffmpegcolorspace\n");
>         return 0;
>     }
>
>     //Create video sink
>     vsink = gst_element_factory_make("xvimagesink", "video-sink");
>     if ( !vsink ) {
>         g_printerr("Failed to create xvimagesink\n");
>         return 0;
>     }
>
>     /* Set up the pipeline */
>     gst_bin_add_many(GST_BIN (pipeline), udpsrc_rtp, gstrtpbin/*,
> jitterbuf*/,
>             rtpdec, vdec, vconv, vsink, NULL);
>
>     //link udpsrc_rtp to gstrtpbin
>     pad = gst_element_get_request_pad(gstrtpbin, "recv_rtp_sink_%d");
>     if ( !pad ) {
>         g_printerr("Failed to create pad\n");
>         return 0;
>     }
>     res = gst_pad_link(gst_element_get_pad(udpsrc_rtp, "src"), pad);
>     gst_object_unref(GST_OBJECT (pad));
>     if ( GST_PAD_LINK_FAILED(res)  ) {
>         g_printerr("Failed to link pads\n");
>         return 0;
>     }
>
>     err = gst_element_link_many(gstrtpbin, rtpdec, vdec, vconv, vsink,
> NULL);
>     if ( err==FALSE ) {
>         g_printerr("Failed to link elements\n");
>         return 0;
>     }
>
>     return pipeline;
> }
>
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20100301/9701fbfb/attachment.htm>


More information about the gstreamer-devel mailing list