GNOME Bugzilla – Bug 340174
locking problem in gstbasesink
Last modified: 2006-05-08 11:49:59 UTC
I hope this won't be a bold comment again ;). When changing state from PLAYING to PAUSED basesink tries to lock the PREROLL_LOCK (line 2476). It does the same thing before calling the ::render method of the object in gst_base_sink_queue_object (line 1664). So far so good. But, if the sink is in ::render, blocking to wait for a condition that would allow it to write (like fdsink blocking on select(), waiting for the file descriptor to be ready for a write) it might block since gst_base_sink_change_state calls the ::unlock method of the object AFTER trying to take the PREROLL_LOCK One obvious solution (and working though not necessarily the best) would be to call the ::unlock method before trying to take the preroll_lock in gst_base_sink_change_state. Sorry if I'm not clear enough. NOTE: I noticed that the same problem can happen in gst_base_sink_set_flushing ()
Created attachment 64552 [details] [review] proposed patch
this looks indeed like a real problem. We seem to only use the unlock method in fdsink, currently.
Patch by: Philippe Rouquier <philippero at libertysurf dot fr> * libs/gst/base/gstbasesink.c: (gst_base_sink_set_flushing), (gst_base_sink_change_state): call ::unlock before taking the PREROLL_LOCK so we can safely handle elements that lock in ::render. Fixes #340174.