GNOME Bugzilla – Bug 660156
rtpbin: free_stream() does not remove the stream reference from the associated client's stream list
Last modified: 2013-02-07 13:58:58 UTC
In free_stream() function, the stream is freed, but the stream reference is not removed from the client->streams list and the client->nstreams counter is not decremented.The stream cleanup logic exists in free_session(). But there are cases when free_stream() is called without removing the session. One such case is when the "autoremove" property is set on gstrtpbin. If this property is set, the rtpjitterbuffer and the ptdemuxer associated with the stream is cleaned up, but the session might still be receiving media from another SSRC. Now if a new stream is received from the same client (same cname) as which was removed, the client->nstreams counter is incremented and now refelcts incorrect number of streams belonging to this client. As a result in gst_rtp_bin_associate() while walking the client->streams list, the stale stream is operated upon, causing assertion failures downstream since the stream's jitterbuffer has already been cleaned up and is no longer a valid GObject.
Created attachment 197520 [details] [review] A proposed patch for the fix
Some things are wrong: * BIN_LOCK is taken while free_stream is sometimes called with the lock. * When a client is removed, client_walk is set to NULL and it doesn't check if other clients contain the stream.
commit 978cc9f538647414c116c464c4001f5ab19a90e9 Author: Wim Taymans <wim.taymans@collabora.co.uk> Date: Mon Sep 26 14:42:51 2011 -0700 rtpbin: rework cleanup of streams Move the work of cleaning up the client streams in the free_stream function. This allows us to properly clean up the client streams when we remove an RTP stream as well. Based on patch by Sujay <sdatar@cisco.com> Fixes https://bugzilla.gnome.org/show_bug.cgi?id=660156
*** Bug 667810 has been marked as a duplicate of this bug. ***