<span style="font-family: courier new,monospace;">Hi experts,<br><br>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.<br>
</span><pre class="programlisting">gst<span class="symbol">-</span>launch <span class="symbol">-</span>v gstrtpbin name<span class="symbol">=</span>rtpbin                                          \<br>    udpsrc caps<span class="symbol">=</span><span class="string">&quot;application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264&quot;</span> \<br>
            port<span class="symbol">=</span><span class="number">5000</span> <span class="symbol">!</span> rtpbin<span class="symbol">.</span>recv_rtp_sink_0                                \<br>        rtpbin<span class="symbol">. !</span> rtph264depay <span class="symbol">!</span> ffdec_h264 <span class="symbol">!</span> xvimagesink                    \<br>
</pre><br><span style="font-family: courier new,monospace;">But I couldn&#39;t link gstrtpbin and rtph264depay. The error message is as follows:<br><font size="1">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)<br>
0:00:00.135657988  5934  0x95aa008 INFO        GST_ELEMENT_PADS gstelement.c:970:gst_element_get_static_pad: no such pad &#39;recv_rtp_src_%d_%d_%d&#39; in element &quot;gst-rtp-bin&quot;<br>0:00:00.135679108  5934  0x95aa008 INFO        GST_ELEMENT_PADS gstutils.c:1208:gst_element_get_compatible_pad:&lt;gst-rtp-bin&gt; Could not find a compatible pad to link to rtp-decoder:sink</font><br>
<br>Could someone give me some hints? Why I have no &quot;recv_rtp_src_%d_%d_%d&quot;? Or could someone lead me to similar examples? Thanks in advance!<br><br>Regards,<br><br>Qin<br><br><br>static</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">GstElement* construct_receiver_pipeline(void){</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    GstElement *pipeline, *gstrtpbin, *vdec, *rtpdec, *vsink;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    GstElement *jitterbuf, *vconv;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    GstElement *udpsrc_rtp;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    GstCaps *caps;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    GstPad  *pad;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    gboolean err;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    GstPadLinkReturn res;</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    //Create gstrtpbin</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    gstrtpbin = gst_element_factory_make(&quot;gstrtpbin&quot;, &quot;gst-rtp-bin&quot;);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    if ( !gstrtpbin ) {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        g_printerr(&quot;Failed to create gstrtpbin\n&quot;);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        return 0;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    }</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    g_object_set(G_OBJECT (jitterbuf), &quot;latency&quot;, jitter_latency, NULL);</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    //RTP ource initialization</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    udpsrc_rtp = gst_element_factory_make(&quot;udpsrc&quot;, &quot;udp-udpsrc_rtp&quot;);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    if ( !udpsrc_rtp ) {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        g_printerr(&quot;Failed to create udpsrc\n&quot;);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        return 0;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    }</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    g_object_set(G_OBJECT (udpsrc_rtp), &quot;port&quot;, rtp_port, NULL);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    //gst_caps_new_simple and gst_element_linked_filter don&#39;t work</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    g_object_set(G_OBJECT (udpsrc_rtp), &quot;caps&quot;,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">            gst_caps_from_string(&quot;application/x-rtp, &quot;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">                    &quot;clock-rate=(int)90000, &quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">                    &quot;payload=(int)96, &quot;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">                    &quot;media=(string)video, &quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">                    &quot;encoding-name=(string)H264&quot;), NULL);</span><span style="font-family: courier new,monospace;"></span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    //Create video decoder</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    vdec = gst_element_factory_make(vdecoder, &quot;video-decoder&quot;);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    if ( !vdec ) {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        g_printerr(&quot;Failed to create %s\n&quot;, vdecoder);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        return 0;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    }</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    //Choose RTP decoder according to video codec</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    rtpdecoder = g_strdup(select_rtp_decoder(vdecoder));</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    g_free(vdecoder);</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    //Create rtp decoder</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    rtpdec = gst_element_factory_make(rtpdecoder, &quot;rtp-decoder&quot;);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    if ( !rtpdec ) {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        g_printerr(&quot;Failed to create %s\n&quot;, rtpdecoder);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        return 0;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    }</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    //Create video converter</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    vconv = gst_element_factory_make(&quot;ffmpegcolorspace&quot;, &quot;video-converter&quot;);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    if ( !vconv ) {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        g_printerr(&quot;Failed to create ffmpegcolorspace\n&quot;);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        return 0;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    }</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    //Create video sink</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    vsink = gst_element_factory_make(&quot;xvimagesink&quot;, &quot;video-sink&quot;);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    if ( !vsink ) {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        g_printerr(&quot;Failed to create xvimagesink\n&quot;);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        return 0;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    }</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    /* Set up the pipeline */</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    gst_bin_add_many(GST_BIN (pipeline), udpsrc_rtp, gstrtpbin/*, jitterbuf*/,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">            rtpdec, vdec, vconv, vsink, NULL);</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    //link udpsrc_rtp to gstrtpbin</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    pad = gst_element_get_request_pad(gstrtpbin, &quot;recv_rtp_sink_%d&quot;);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    if ( !pad ) {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        g_printerr(&quot;Failed to create pad\n&quot;);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        return 0;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    }</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    res = gst_pad_link(gst_element_get_pad(udpsrc_rtp, &quot;src&quot;), pad);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    gst_object_unref(GST_OBJECT (pad));</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    if ( GST_PAD_LINK_FAILED(res)  ) {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        g_printerr(&quot;Failed to link pads\n&quot;);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        return 0;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    }</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    err = gst_element_link_many(gstrtpbin, rtpdec, vdec, vconv, vsink, NULL);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    if ( err==FALSE ) {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        g_printerr(&quot;Failed to link elements\n&quot;);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        return 0;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    }</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    return pipeline;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">}</span><br>