After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 535218 - gst_base_src_send_event will block if basesrc is blocking in its create function.
gst_base_src_send_event will block if basesrc is blocking in its create funct...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
0.10.19
Other All
: Normal major
: 0.10.20
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2008-05-28 08:21 UTC by Bjarne Rosengren
Modified: 2008-05-28 13:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
First shot at a patch (3.45 KB, patch)
2008-05-28 08:25 UTC, Bjarne Rosengren
committed Details | Review

Description Bjarne Rosengren 2008-05-28 08:21:43 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:
Comment 1 Bjarne Rosengren 2008-05-28 08:25:00 UTC
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
Comment 2 Wim Taymans 2008-05-28 13:49:42 UTC
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.