<div dir="ltr"><div dir="ltr">Hi all,<br></div><div dir="ltr"><br></div><div>I have traced the problem to a specific area and was hoping for further insights.</div><div><br></div><div>1) I have a main_gstreamer_pipeline with an appsink element. </div><div><br></div><div>2) On another thread, I have the RTSP server, which has an appsrc element that hooks up to the appsink.  </div><div><br></div><div>3) When the new client connects, there is a "media-configure" callback.</div><div><br></div><div>4) In this callback, I register for the "need-data" signal where I "pull-sample" from appsink and then "push-buffer" onto the appsrc that is driving the RTSP pipeline</div><div><br></div><div>5) Prior to registering for the "need-data" signal I have to stop the main_gstreamer_pipeline, after registration I start the main_gstreamer_pipeline.</div><div><br></div><div>6) If I do not stop and start the main pipeline the VLC client does not work. I do not see a stream.</div><div><br></div><div>7) If I stop and start the main pipeline, the VLC client shows the stream (the first time) but when I go to start the pipeline a second time on a second VLC connection, it throws the segmentation fault below. The fault is being thrown when I am stopping the main_gstreamer_pipeline() in media-configure.</div><div><br></div><div>8) Maybe I should be stopping only the RTSP portion of the pipeline only instead of the main gstreamer pipeline ?  </div><div><br></div><div>To launch the RTSP pipeline I am using <b>gst_rtsp_media_factory_set_launch(gst_rtsp_factory_var, rtsp_pipeline_config.c_str()); </b></div><div>Not sure how to access the pipeline when it is created like this ?</div><div><br></div><div>9) I tried hooking up for the client-closed callback and cleanup the session pool. Confirmed the call back is made when the client closes, but didn't help. Not sure if it is even necessary ?</div><div><br></div><div>void client_closed_callback(GstRTSPClient *self, gpointer user_data){</div><div>    GstRTSPServer *server = GST_RTSP_SERVER(user_data);</div><div>    GstRTSPSessionPool *pool = gst_rtsp_server_get_session_pool(server);</div><div>    guint removed = gst_rtsp_session_pool_cleanup(pool);</div><div>    g_object_unref(pool);</div><div>}</div><div><br></div><div><br></div><div>Any help is appreciated. Thank you.</div><div><br></div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Dec 14, 2021 at 10:08 AM Dwight Kulkarni <<a href="mailto:dwight@realtime-7.com">dwight@realtime-7.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hello everyone,</div><div><br></div><div>I am facing a strange behavior with my RTSP server setup and was hoping for any assistance.</div><div><br></div><div>The issue is that I have an RTSP Server that starts on a thread.</div><div><br></div><div>When no VLC client is connected, I check the memory and it is stable.</div><div><br></div><div>When I connect the VLC client there is an initial jump in the memory usage of about 20-30 mb.</div><div><br></div><div>Thereafter, the memory usage climbs by a few megs every 10-20 seconds and stabilizes around 80 mb.</div><div><br></div><div>The problem seems to occur after I disconnect the VLC client by closing the window.</div><div><br></div><div>The used up memory from the VLC connection is not released. If I try to connect with the VLC Client again, it gives me a segmentation fault and breaks the application. The message I get is:</div><div><br></div><div><i>(server:2331): GStreamer-CRITICAL **: 14:54:31.771: <br>Trying to dispose element pipeline0, but it is in READY instead of the NULL state.<br>You need to explicitly set elements to the NULL state before<br>dropping the final reference, to allow them to clean up.<br>This problem may also be caused by a refcounting bug in the<br>application or some element.<br><br>Segmentation fault</i></div><div><br></div><div>It seems as if I need to dispose something which I am not presently doing when the client is disconnected. Maybe I need to stop the pipeline when no more clients are present ?</div><div><br></div><div>Please see attached code.<br></div><div><br>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><span style="font-size:12.8px">Sincerely,</span><div><br></div><div>Dwight Kulkarni                <br></div></div></div></div></div></div></div></div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><span style="font-size:12.8px">Sincerely,</span><div><br></div><div>Dwight Kulkarni          </div></div></div></div></div></div></div></div>