<div dir="ltr">Thank you Prabhakar.<div><br></div><div>I couldn't get it to cleanly close down the server. The following is the simplest example I could make to reproduce this.</div><div><br></div><div><div>#include <gst/gst.h></div><div><br></div><div>#include <gst/rtsp-server/rtsp-server.h></div><div><br></div><div>static gboolean timeout(GMainLoop *loop) {</div><div>  g_main_loop_quit(loop);</div><div>  return FALSE;</div><div>}</div><div><br></div><div>int main(int argc, char *argv[]) {</div><div>  GMainLoop *loop;</div><div>  GstRTSPServer *server;</div><div><br></div><div>  gst_init(NULL, NULL);</div><div><br></div><div>  loop = g_main_loop_new(NULL, FALSE);</div><div>  server = gst_rtsp_server_new();</div><div>  g_object_set(server, "service", "8555", NULL);</div><div>  gst_rtsp_server_attach(server, NULL);</div><div>  g_timeout_add_seconds(2, (GSourceFunc) timeout, loop);</div><div>  g_main_loop_run(loop);</div><div>  gst_object_unref(server);</div><div>  g_main_loop_unref(loop);</div><div><br></div><div>  loop = g_main_loop_new(NULL, FALSE);</div><div>  server = gst_rtsp_server_new();</div><div>  g_object_set(server, "service", "8555", NULL);</div><div>  gst_rtsp_server_attach(server, NULL);</div><div>  g_timeout_add_seconds(2, (GSourceFunc) timeout, loop);</div><div>  g_main_loop_run(loop);</div><div>  gst_object_unref(server);</div><div>  g_main_loop_unref(loop);</div><div><br></div><div>  return 0;</div><div>}</div></div><div><br></div><div>The weird thing I found out is that commenting the gst_init() resolves the issue..</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 10 March 2016 at 13:08, Lad, Prabhakar <span dir="ltr"><<a href="mailto:prabhakar.csengg@gmail.com" target="_blank">prabhakar.csengg@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
On Thu, Mar 10, 2016 at 10:02 AM, Serj TorresSoldado<br>
<<a href="mailto:torres.soldado@gmail.com">torres.soldado@gmail.com</a>> wrote:<br>
> Hi,<br>
><br>
>  I am using a rtspserver with an appsink element.<br>
><br>
>  I am currently having issues when trying to dispose and recreate a<br>
> rtspserver. To delete the server I am doing to following operations:<br>
><br>
> g_main_loop_quit()<br>
> g_source_remove() to remove the source from attaching the server.<br>
> g_main_loop_unref()<br>
> g_object_unref(server)<br>
><br>
> I can create a new server on the same port but I cant connect to it with a<br>
> client.<br>
><br>
> Also I had an issue when trying to delete the server while a client is<br>
> connected, it would crash because a udpsrc element was stuck in the play<br>
> state. As a workaround I am stopping the appsink "need-data" callback before<br>
> destroying the server.<br>
><br>
> I can't find any example of how to properly dispose of a server because the<br>
> existing examples seem to depend on the main process exit.<br>
><br>
Make sure you send a EOS first (if you have a queue in a pipeline have<br>
flush-on-eos=true),<br>
catch it on the bus handler then later do a mail_loop quit unref that object,<br>
remove the factory (gst_rtsp_mount_points_remove_factory ()), unref<br>
the mounts object,<br>
unref the factory object and lastly unref the server object.<br>
<br>
Cheers,<br>
--Prabhakar Lad<br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
</blockquote></div><br></div>