rtpbin: Make cleaning up sources in rtp_session_on_timeout MT safe
authorPascal Buhler <pascal.buhler@tandberg.com>
Fri, 24 Sep 2010 13:33:40 +0000 (15:33 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Fri, 24 Sep 2010 13:38:00 +0000 (15:38 +0200)
commitca6a512b5eef7434a2a09310317944b08323578b
tree522d1e82f1646c29d7527362389251d486685d6d
parent87a9d7f679b60af713ad9318125094a92fa487ab
rtpbin: Make cleaning up sources in rtp_session_on_timeout MT safe

Using _foreach_remove on the hashtable, while releasing the lock protecting
that table inside the callback is not a good idea. The hashtable might
then change (a source removed or added) while signals like on_timeout
are being sent.

This solution makes a copy of the table, performs the _foreach without
actually removing any sources, but marks them for removal on a second
iteration with the real list, but this time not letting go of the lock.

Fixes #630452
gst/rtpmanager/rtpsession.c
gst/rtpmanager/rtpsource.c
gst/rtpmanager/rtpsource.h