GNOME Bugzilla – Bug 535218
gst_base_src_send_event will block if basesrc is blocking in its create function.
Last modified: 2008-05-28 13:49:42 UTC
Please describe the problem: I've an application that needs to send an EOS to a basesrc-element at any time. If the basesrc element is blocking in its create function the call to gst_base_src_send_event will block until the create-function unblocks and in my case it can take quit some time. It would be better if the call just queues the EOS and then returns. Steps to reproduce: 1. 2. 3. Actual results: Expected results: Does this happen every time? Other information:
Created attachment 111648 [details] [review] First shot at a patch This patch will try to do something like this: set EOS flag; unlock; STREAM_LOCK; unlock_stop; STREAM_UNLOCK
I changed some things, mostly we only need to take the LIVE_LOCK before we can safely call unlock_stop so that we don't block when downstream is blocked in a push. Also moved around the check for the pending_eos because we now don't protect it anymore with the LIVE_LOCK. Also added plenty of comments about how and why it works. Based on patch by: Bjarne Rosengren <bjarne at axis dot com> * libs/gst/base/gstbasesrc.c: (gst_base_src_send_event), (gst_base_src_get_range), (gst_base_src_pad_get_range), (gst_base_src_loop), (gst_base_src_set_flushing), (gst_base_src_change_state): Make sending an EOS event to the basesrc non-blocking even if the implementation does blocking waits in the create function. This is done by unlocking the create function when EOS is sent. Fixes #535218.