GStreaner rtpbin problem
Ingemar Johansson S
ingemar.s.johansson at ericsson.com
Sat Jan 26 18:52:02 UTC 2019
Hi
New on this list, hope that this question fits here. I am working to
implement a SCReAM (https://tools.ietf.org/html/rfc8298 ) plugin for
GStreamer. The end goal is to enable congestion control especially for
video.
Currently I try to make applications for the sender and receiver side. I
have a problem with the code further down below. The error occurs at the
line
"lres = gst_pad_link (srcpad, sinkpad);"
I have tried to double check agaist other examples and I don't find anything
wrong but obviously there must be something ?
Regards
Ingemar
=========
(gscream_app_rx:24376): GLib-GObject-CRITICAL **: 18:40:46.833:
g_object_unref: assertion 'G_IS_OBJECT (object)' failed
**
ERROR:gscream_app_rx.cpp:166:int main(int, char**): assertion failed: (lres
== GST_PAD_LINK_OK)
Aborted (core dumped)
=========
int main (int argc, char *argv[])
{
std::printf("going for video from IP: %s\n on port 5000", argv[1]);
GMainLoop *loop;
GstElement *rtpbin, *pipeline, *capsfilter, *rtpsrc, *rtcpsrc, *rtcpsink,
*rtpdepay,
*decodebin, *videoconvert, *autovideosink;
GstBus *bus;
guint bus_watch_id;
GstCaps *udpcaps;
GstPadLinkReturn lres;
GstPad *srcpad, *sinkpad;
/* Initialisation */
gst_init (&argc, &argv);
loop = g_main_loop_new (NULL, FALSE);
/* Create gstreamer elements */
pipeline = gst_pipeline_new ("video-pipeline");
rtpsrc = gst_element_factory_make("udpsrc", "rtpsrc");
udpcaps = gst_caps_new_simple ("application/x-rtp",
"media", G_TYPE_STRING,"video",
"clock-rate", G_TYPE_INT, 90000,
"encoding-name",G_TYPE_STRING,"H264",
NULL);
g_object_set(G_OBJECT(rtpsrc), "port", 5000, "caps", udpcaps, NULL);
gst_object_unref(udpcaps);
rtcpsrc = gst_element_factory_make("udpsrc", "rtcpsrc");
g_object_set(G_OBJECT(rtcpsrc), "port", 5001, NULL);
g_assert (rtcpsrc);
rtcpsink = gst_element_factory_make("udpsink",
"rtcpsink");
g_object_set (rtcpsink, "port", 5003, "host", argv[1], NULL);
/* no need for synchronisation or preroll on the RTCP sink */
g_object_set (rtcpsink, "async", FALSE, "sync", FALSE, NULL);
g_assert (rtcpsink);
rtpdepay = gst_element_factory_make("rtph264depay",
"rtph264depay");
decodebin = gst_element_factory_make ("avdec_h264",
"avdec_h264");
videoconvert = gst_element_factory_make ("videoconvert",
"videoconvert");
autovideosink = gst_element_factory_make ("autovideosink",
"videosink");
if (!pipeline || !rtpdepay || !decodebin || !videoconvert ||
!autovideosink) {
g_printerr ("One element could not be created. Exiting.\n");
return -1;
}
/* Set up the pipeline */
/* we add a message handler */
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
bus_watch_id = gst_bus_add_watch (bus, bus_call, loop);
gst_object_unref (bus);
/* we add all elements into the pipeline */
gst_bin_add_many (GST_BIN (pipeline),
rtpsrc, rtpdepay, decodebin, videoconvert,
autovideosink, NULL);
/* we link the elements together */
/* videotestsrcm -> autovideosink */
if(!gst_element_link_many (rtpsrc, rtpdepay, decodebin, videoconvert,
autovideosink, NULL)){
g_error("Could not link on ore more of elements udpsrc, rtpdepay
decodebin");
return -1;
}
/* 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 an RTCP sinkpad in session 0 */
srcpad = gst_element_get_static_pad (rtcpsrc, "src");
sinkpad = gst_element_get_request_pad (rtpbin, "recv_rtcp_sink_0");
lres = gst_pad_link (srcpad, sinkpad);
g_assert (lres == GST_PAD_LINK_OK);
gst_object_unref (srcpad);
gst_object_unref (sinkpad);
/* get an RTCP srcpad for sending RTCP back to the sender */
srcpad = gst_element_get_request_pad (rtpbin, "send_rtcp_src_0");
sinkpad = gst_element_get_static_pad (rtcpsink, "sink");
lres = gst_pad_link (srcpad, sinkpad);
g_assert (lres == GST_PAD_LINK_OK);
gst_object_unref (sinkpad);
/* the RTP pad that we have to connect to the depayloader will be created
* dynamically so we connect to the pad-added signal, pass the depayloader
as
* user_data so that we can link to it. */
g_signal_connect (rtpbin, "pad-added", G_CALLBACK (pad_added_cb),
rtpdepay);
/* give some stats when we receive RTCP */
g_signal_connect (rtpbin, "on-ssrc-active", G_CALLBACK
(on_ssrc_active_cb),
rtpdepay);
//GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(pipeline), GST_DEBUG_GRAPH_SHOW_ALL,
"recv-pipeline-bf-playing");
/* Set the pipeline to "playing" state*/
g_print ("Now set pipeline in state playing\n");
gst_element_set_state (pipeline, GST_STATE_PLAYING);
GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(pipeline), GST_DEBUG_GRAPH_SHOW_ALL,
"recv-pipeline-af-playing-bf-running");
/* Iterate */
g_print ("Running...\n");
g_main_loop_run (loop);
GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(pipeline), GST_DEBUG_GRAPH_SHOW_ALL,
"recv-pipeline-af-running");
/* Out of the main loop, clean up nicely */
g_print ("Returned, stopping playback\n");
gst_element_set_state (pipeline, GST_STATE_NULL);
GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(pipeline), GST_DEBUG_GRAPH_SHOW_ALL,
"recv-pipeline-af-stop");
g_print ("Deleting pipeline\n");
gst_object_unref (GST_OBJECT (pipeline));
g_source_remove (bus_watch_id);
g_main_loop_unref (loop);
return 0;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20190126/78330fb1/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6332 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20190126/78330fb1/attachment-0001.bin>
More information about the gstreamer-devel
mailing list