pythonrtsppython-gstreamer

How to destroy Gstreamer RTSP Server Object without exiting main application


I'm creating a GstRTSPServer, and associating a service i.e. port to it using GstRtspServer.RTSPServer.set_service(). Now I want to destroy or kill the server so as to free the port, but without exiting my main application, so that port can be reused. How can I do the same without exiting my main application.

P.S.: I referred to Free Desktop Docs but couldn't find a method for the same. I'm using python bindings for the same.

Please suggest.


Solution

  • After spending more time with RTSP Server documentation. I figured out that, although there's no associated method to destroy RTSP Server. It can be done by unreferencing the GObject.Maincontext() instance I'm attaching the server to.

    So, context.unref(), frees the associated port with server, without exiting my main application.