RTP stream: change the payload type
Elio Francesconi
elio.francesconi at gmail.com
Thu Oct 31 09:33:05 CET 2013
This is the code I wrote to transmit video via rtp, that is not working.
Do you see something wrong? How could I debug such kind of issues?
Thanks in advance
Elio
/* the pipeline to hold everything */
pPipeline = gst_pipeline_new (NULL);
g_assert (pPipeline);
/* the audio capture and format conversion */
source = gst_element_factory_make ("videotestsrc","videosrc");
g_assert (source);
converter = gst_element_factory_make ( "videoconvert", "videoconv");
g_assert (converter);
/* the encoding and payloading */
encoder = gst_element_factory_make ("vp8enc", "videoenc");
g_assert (encoder);
pay = gst_element_factory_make ("rtpvp8pay", "videopay");
g_assert (pay);
g_object_set(pay, "pt", 103, NULL);
GstElement *filter = gst_element_factory_make ("capsfilter", "filter");
GstCaps *filtercaps = gst_caps_new_simple ("video/x-raw",
"format", G_TYPE_STRING, "I420",
"width", G_TYPE_INT, 320,
"height", G_TYPE_INT, 240,
NULL);
g_object_set (G_OBJECT (filter), "caps", filtercaps, NULL);
gst_caps_unref (filtercaps);
/* add capture and payloading to the pipeline and link */
gst_bin_add_many (GST_BIN (pPipeline), source, filter, converter, encoder, pay, NULL);
if (!gst_element_link_many (source, filter, converter, encoder, pay, NULL))
{
g_error ("Failed to link source, videorate, converter, encoder, pay");
return false;
}
/* the rtpbin element */
rtpbin = gst_element_factory_make ("rtpbin", "rtpbin");
g_assert (rtpbin);
gst_bin_add (GST_BIN (pPipeline), rtpbin);
/* the udp sinks and source we will use for RTP and RTCP */
rtpsink = gst_element_factory_make ("udpsink", "rtpsink");
g_assert (rtpsink);
g_object_set (rtpsink, "port", remoteAddr.getRtpPort(), "host", remoteAddr.getAddress().c_str(), NULL);
rtcpsink = gst_element_factory_make ("udpsink", "rtcpsink");
g_assert (rtcpsink);
g_object_set (rtcpsink, "port", remoteAddr.getRtcpPort(), "host", remoteAddr.getAddress().c_str(), NULL);
/* no need for synchronisation or preroll on the RTCP sink */
g_object_set (rtcpsink, "async", FALSE, "sync", FALSE, NULL);
rtcpsrc = gst_element_factory_make ("udpsrc", "rtcpsrc");
g_assert (rtcpsrc);
g_object_set (rtcpsrc, "port", localAddr.getRtcpPort(), NULL);
gst_bin_add_many (GST_BIN (pPipeline), rtpsink, rtcpsink, rtcpsrc, NULL);
/* now link all to the rtpbin, start by getting an RTP sinkpad for session 0 */
sinkpad = gst_element_get_request_pad (rtpbin, "send_rtp_sink_0");
srcpad = gst_element_get_static_pad (pay, "src");
if (gst_pad_link (srcpad, sinkpad) != GST_PAD_LINK_OK)
g_error ("Failed to link audio payloader to rtpbin");
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_static_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");
gst_object_unref (srcpad);
gst_object_unref (sinkpad);
/* get an RTCP srcpad for sending RTCP to the receiver */
srcpad = gst_element_get_request_pad (rtpbin, "send_rtcp_src_0");
sinkpad = gst_element_get_static_pad (rtcpsink, "sink");
if (gst_pad_link (srcpad, sinkpad) != GST_PAD_LINK_OK)
g_error ("Failed to link rtpbin to rtcpsink");
gst_object_unref (sinkpad);
/* we also want to receive RTCP, request an RTCP sinkpad for session 0 and
* link it to the srcpad of the udpsrc for RTCP */
srcpad = gst_element_get_static_pad (rtcpsrc, "src");
sinkpad = gst_element_get_request_pad (rtpbin, "recv_rtcp_sink_0");
if (gst_pad_link (srcpad, sinkpad) != GST_PAD_LINK_OK)
g_error ("Failed to link rtcpsrc to rtpbin");
gst_object_unref (srcpad);
On 30 Oct 2013, at 22:21, Sebastian Dröge <sebastian at centricular.com> wrote:
> On Mi, 2013-10-30 at 22:17 +0100, Elio Francesconi wrote:
>> Hi all,
>> I’m creating a pipeline to send rtp video stream but I cannot find any option to change he payload type.
>>
>> gst-launch-0.10 -v videotestsrc ! vp8enc ! rtpvp8pay ! udpsink host=127.0.0.1 port=5011
>
> The "pt" property on the payloaders can be used for that.
>
> You should also consider updating to GStreamer 1.x if possible as 0.10
> is no longer maintained since almost two years.
>
> --
> Sebastian Dröge <sebastian at centricular.com>
> Centricular Ltd - http://www.centricular.com
> Expertise, Straight from the Source
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20131031/96ad98c1/attachment-0001.html>
More information about the gstreamer-devel
mailing list