After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 650887 - Adding function to close all current sessions
Adding function to close all current sessions
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-rtsp-server
unspecified
Other Linux
: Normal minor
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-05-23 17:00 UTC by Marco Madrigal
Modified: 2012-11-20 12:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch file to add function to close all client's sessions. (4.09 KB, patch)
2011-05-23 17:00 UTC, Marco Madrigal
needs-work Details | Review
Modified patch file to add function to close all client's sessions. (4.97 KB, patch)
2011-05-24 20:35 UTC, Marco Madrigal
none Details | Review

Description Marco Madrigal 2011-05-23 17:00:56 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.
Comment 1 Sebastian Dröge (slomo) 2011-05-24 08:04:25 UTC
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.
Comment 2 Marco Madrigal 2011-05-24 20:35:49 UTC
Created attachment 188522 [details] [review]
Modified patch file to add function to close all client's sessions.
Comment 3 Marco Madrigal 2011-05-24 20:37:57 UTC
Hello Sebastian, thanks for the notes. I just sent the new patch modified.
Comment 4 Wim Taymans 2011-08-16 10:02:06 UTC
Isn't is just easier to use the gst_rtsp_session_pool_filter() method? it was made to clean up everything..
Comment 5 Marco Madrigal 2011-08-19 17:42:04 UTC
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.
Comment 6 Wim Taymans 2012-11-20 12:36:19 UTC
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.