GNOME Bugzilla – Bug 727231
rtsp-server: The media streams leak
Last modified: 2014-04-08 13:03:01 UTC
The stream objects leak if you only send a SETUP request in a streaming session. This can easily be reproduced by the following steps: 1) connect to an RTSP server 2) send a SETUP request 3) close the connection. This error only occurs when just the SETUP (doesn't matter if you only send SETUP for one or more streams) is called. If a DESCRIBE request is sent before the SETUP there is no problem. It's not a problem if you send a PLAY request after the SETUP either.
The problem is that the src pads of the rtsp bin becomes blocked when prerolling a live media. The pads are blocked from the stream objects in gst_rtsp_stream_set_blocked. The blocking probe gets a a reference to the stream object as user data. When closing the connection when only a SETUP for a live media has been sent, the src pads are still blocked and holds a reference to a stream object. The stream object holds a reference to the src pads as well. Neither the pads or stream will be finalized in this case.
Created attachment 273454 [details] [review] Unblock the stream objects in unprepare Extended the unit test to also test with a live media. When running the unit tests without the change in rtsp-media.c, it is obvious that the stream objects are not freed. Valgrind does, however, not complain about any leaks. I suspect that the reason is that the stream object holds a reference to the src pad and the src pad holds a reference to the stream object.
Created attachment 273455 [details] [review] cleanup threadpools
commit 6916875a0b31bc2484cb16613813974348ba068c Author: Linus Svensson <linussn@axis.com> Date: Tue Apr 1 16:55:13 2014 +0200 media test: cleanup the thread pool in tests commit a3e6b11f11e18f2d67cffafdd65a51f47cd7b64f Author: Linus Svensson <linussn@axis.com> Date: Tue Apr 1 13:16:26 2014 +0200 rtsp-media: Unblock blocked streams in unprepare The streams will be blocked when a live media is prepared. The streams should be unblocked in gst_rtsp_media_unprepare. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=727231