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 109313 - gstqueue: writer thread not unblocked if full queue is flushed
gstqueue: writer thread not unblocked if full queue is flushed
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
0.6.0
Other All
: Normal minor
: 0.6.x
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2003-03-27 03:44 UTC by janzen
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to wake writer thread when full queue is flushed via src pad (1.03 KB, patch)
2003-03-27 03:45 UTC, janzen
none Details | Review

Description janzen 2003-03-27 03:44:53 UTC
I have an element which, under some circumstances, needs to flush either
the upstream (transport buffer) or downstream (frame buffer) queue (or
maybe both; still under construction!).

Flushing the downstream queue is easy:

  gst_pad_push (myelement->srcpad,
    GST_BUFFER (gst_event_new_flush ()));

And if I understand correctly, flushing the upstream one is not much more
difficult; something like this:

  GstPad *peer = gst_pad_get_peer (myelement->sink_pad);
  GstElement *src = gst_pad_get_parent (src);
  if (GST_IS_QUEUE (src)) {
    gst_element_set_state (src, GST_STATE_PAUSED);
    gst_pad_send_event (peer, gst_event_new_flush ());
    gst_element_set_state (src, GST_STATE_PLAYING);
  }

(Arguably this code shouldn't be in my element itself; instead, the element
could generate a signal which causes the main program to flush the queue,
for instance.  But for testing...)

Anyway, the problem I found is that, if the upstream queue is full and a
writer thread is blocked waiting for the queue to empty, that thread will
stay blocked forever.

It looks to me as though the gst_queue_handle_src_event() event function
which flushes the queue should also wake up the writer thread.

It's a trivial fix (see attached patch), and I've tested it successfully;
but I just want to make sure that sending events upstream as I've done
above is acceptable practice, and that the GStreamer framework in fact
intends to support this sort of thing.  Comments...?
Comment 1 janzen 2003-03-27 03:45:41 UTC
Created attachment 15223 [details] [review]
patch to wake writer thread when full queue is flushed via src pad
Comment 2 janzen 2003-03-27 04:06:32 UTC
This patch (slighly modified) has been merged into CVS (gstqueue.c
-r1.67, gstqueue.h -r1.14) by "company"; thanks!