GNOME Bugzilla – Bug 650887
Adding function to close all current sessions
Last modified: 2012-11-20 12:36:19 UTC
Created attachment 188406 [details] [review] Patch file to add function to close all client's sessions. The current version of gst-rtsp-server doesn't accept to close the current sessions from the server side, it could be a problem when you need to cancel any session before you kill the server. I created a patch file that adds a new function called gst_rtsp_server_close_clients() which closes all the current sessions by closing their connections and releasing the media associated. I attached the patch hoping you can check it. I believe it is necessary to implement a way to close the sessions into the API. Regards, Marco.
Review of attachment 188406 [details] [review]: ::: gst-rtsp-server-0.10.8.orig/src/gst/rtsp-server/rtsp-server.c @@ +390,3 @@ + + g_mutex_lock (server->lock); + clients_list = server->clients; You should return a copy of that list, with every element of the list having the refcount increased by one. The way you're doing it is not threadsafe because the list can change at any point and the caller does not own any references to the clients. @@ +415,3 @@ + { + perror("closing connection"); + exit(0); Calling exit() from a library is in general not very nice. Don't do that and also don't use perror. Use something like GST_ERROR() or GST_ERROR_OBJECT() and then just continue as if nothing happened. Or if this is really a very bad error, use a g_warning() or g_critical() and continue.
Created attachment 188522 [details] [review] Modified patch file to add function to close all client's sessions.
Hello Sebastian, thanks for the notes. I just sent the new patch modified.
Isn't is just easier to use the gst_rtsp_session_pool_filter() method? it was made to clean up everything..
Hi Wim, Maybe you are right, I tried to use gst_rtsp_session_pool_filter() method to close all the current session but I was not able to do that. If I created a session and start a video streaming to a client and then I tried to close this session using this function I didn't get it, when I tried to close the server I got an error (independent of the rtsp-server API) that is caused when the session is still alive. The only way I got to force to close all the current sessions (That because I want to close the sessions even if the client is playing the streaming) was applying the patch I sent. I am wondering if maybe it could be easiest with the rst_rtsp_session_pool_filter() method, this would be great, could you give me an example of how to do that correctly please? Regards, Marco.
commit ca11abd193012f99b33412a0f7eaca8a8ea02a5d Author: Wim Taymans <wim.taymans@collabora.co.uk> Date: Tue Nov 20 13:34:46 2012 +0100 test-auth: add example of how to remove sessions Add an example of the session filter api.