<div dir="auto">I've faced the same issue before. Any suggestions would be appreciated. <div dir="auto"><br></div><div dir="auto">Thanks, </div><div dir="auto">Anuj</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Nov 25, 2016 9:08 PM, "Tejas Ravichandran" <<a href="mailto:venkatakrishnan164@gmail.com">venkatakrishnan164@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi sorry for reposting . <br></div><div>I am using the rtsp test-appsrc application and modified it to work for I420 format images with rtpvrawpay instead of rtph264pay .<br><br></div><div>however for certain resolutions the pipeline fails<br></div><div>like for e.g for 2100 x 576 it fails whereas works for 2104 x 576 but fails for 2106 x 576 and so on... i am not able to understand the pattern .<br></div><div>This is the appsrc modified code for rtsp:<br><br>#include <gst/gst.h><br><br>#include <gst/rtsp-server/rtsp-server.<wbr>h><br><br>typedef struct<br>{<br> gboolean white;<br> GstClockTime timestamp;<br>} MyContext;<br><br>/* called when we need to give data to appsrc */<br>static void<br>need_data (GstElement * appsrc, guint unused, MyContext * ctx)<br>{<br> GstBuffer *buffer;<br> guint size;<br> GstFlowReturn ret;<br> <br> unsigned int sizeInt = (2100*576*3) >> 1;<br><br> size = sizeInt;//2100 * 576 * 1.5;<br><br> buffer = gst_buffer_new_allocate (NULL, size, NULL);<br><br> /* this makes the image black/white */<br> gst_buffer_memset (buffer, 0, ctx->white ? 0xff : 0x0, size);<br><br> ctx->white = !ctx->white;<br><br> /* increment the timestamp every 1/2 second */<br> GST_BUFFER_PTS (buffer) = ctx->timestamp;<br> GST_BUFFER_DURATION (buffer) = gst_util_uint64_scale_int (1, GST_SECOND, 2);<br> ctx->timestamp += GST_BUFFER_DURATION (buffer);<br><br> g_signal_emit_by_name (appsrc, "push-buffer", buffer, &ret);<br>}<br><br>/* called when a new media pipeline is constructed. We can query the<br> * pipeline and configure our appsrc */<br>static void<br>media_configure (GstRTSPMediaFactory * factory, GstRTSPMedia * media,<br> gpointer user_data)<br>{<br> GstElement *element, *appsrc;<br> MyContext *ctx;<br><br> /* get the element used for providing the streams of the media */<br> element = gst_rtsp_media_get_element (media);<br><br> /* get our appsrc, we named it 'mysrc' with the name property */<br> appsrc = gst_bin_get_by_name_recurse_up (GST_BIN (element), "mysrc");<br><br> /* this instructs appsrc that we will be dealing with timed buffer */<br> gst_util_set_object_arg (G_OBJECT (appsrc), "format", "time");<br> /* configure the caps of the video */<br> g_object_set (G_OBJECT (appsrc), "caps",<br> gst_caps_new_simple ("video/x-raw",<br> "format", G_TYPE_STRING, "I420",<br> "width", G_TYPE_INT, 2100,<br> "height", G_TYPE_INT, 576,<br> "framerate", GST_TYPE_FRACTION, 0, 1, NULL), NULL);<br><br> ctx = g_new0 (MyContext, 1);<br> ctx->white = FALSE;<br> ctx->timestamp = 0;<br> /* make sure ther datais freed when the media is gone */<br> g_object_set_data_full (G_OBJECT (media), "my-extra-data", ctx,<br> (GDestroyNotify) g_free);<br><br> /* install the callback that will be called when a buffer is needed */<br> g_signal_connect (appsrc, "need-data", (GCallback) need_data, ctx);<br> gst_object_unref (appsrc);<br> gst_object_unref (element);<br>}<br><br>int<br>main (int argc, char *argv[])<br>{<br> GMainLoop *loop;<br> GstRTSPServer *server;<br> GstRTSPMountPoints *mounts;<br> GstRTSPMediaFactory *factory;<br><br> gst_init (&argc, &argv);<br><br> loop = g_main_loop_new (NULL, FALSE);<br><br> /* create a server instance */<br> server = gst_rtsp_server_new ();<br>gst_rtsp_server_set_address(<wbr>server,"10.0.0.2");<br> /* get the mount points for this server, every server has a default object<br> * that be used to map uri mount points to media factories */<br> mounts = gst_rtsp_server_get_mount_<wbr>points (server);<br><br> /* make a media factory for a test stream. The default media factory can use<br> * gst-launch syntax to create pipelines.<br> * any launch line works as long as it contains elements named pay%d. Each<br> * element with pay%d names will be a stream */<br> factory = gst_rtsp_media_factory_new ();<br> gst_rtsp_media_factory_set_<wbr>launch (factory,<br> "( appsrc name=mysrc ! rtpvrawpay name=pay0 pt=96 )");<br><br> /* notify when our media is ready, This is called whenever someone asks for<br> * the media and a new pipeline with our appsrc is created */<br> g_signal_connect (factory, "media-configure", (GCallback) media_configure,<br> NULL);<br><br> /* attach the test factory to the /test url */<br> gst_rtsp_mount_points_add_<wbr>factory (mounts, "/test", factory);<br><br> /* don't need the ref to the mounts anymore */<br> g_object_unref (mounts);<br><br> /* attach the server to the default maincontext */<br> gst_rtsp_server_attach (server, NULL);<br><br> /* start serving */<br> g_print ("stream ready at rtsp://<a href="http://127.0.0.1:8554/test%5Cn" target="_blank">127.0.0.1:8554/test\n</a>")<wbr>;<br> g_main_loop_run (loop);<br><br> return 0;<br>} <br></div><div>This pipeline fails with a segmentation fault when the client side is run as follows:<br>gst-launch-1.0 rtspsrc latency=50 location=rtsp://<a href="http://10.0.0.2:8555/testing" target="_blank">10.0.0.2:8555/<wbr>testing</a> ! rtpvrawdepay ! videoconvert ! ximagesink -v<br></div><div>with "could not read from resource" message on the client side.<br><br></div><div>However the same code with 2104 x 576 works fine .<br></div><div><br></div><div>NOTE:<br></div><div>Also when i change I420 to NV12 and add a videoconvert before rtpvrawpay every resolution works well i.e by making the following change<br><br><br>"( appsrc name=mysrc ! videconvert ! rtpvrawpay name=pay0 pt=96 )");<br><br> gst_caps_new_simple ("video/x-raw",<br> "format", G_TYPE_STRING, "NV12",<br> "width", G_TYPE_INT, 2100,<br> "height", G_TYPE_INT, 576,<br><br></div><div>Any help would be greatly appreciated.<br></div></div>
<br>______________________________<wbr>_________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.<wbr>freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/gstreamer-<wbr>devel</a><br>
<br></blockquote></div></div>