[gst-devel] gstrtpbin and rtph264depay linking problem

Qin Chen eric.qin.chen at gmail.com
Mon Mar 1 05:24:36 CET 2010


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"? 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;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20100228/c8aa5342/attachment.htm>


More information about the gstreamer-devel mailing list