This is either a rewrite or a large bugfix to the queue element, whatever you prefer to call it.

Original commit message from CVS:
This is either a rewrite or a large bugfix to the queue element, whatever
you prefer to call it.

* upstream event forwarding now works. This should fix Julien's issues.
* this queue allows setting a min. treshold size and a max. limit size
in bytes, buffers and time before the queue allows the next element
to pull data or the previous element to push data into it. This is
very interesting for network-related buffering. Also includes signals
et all for the end user application.
* Events are no longer part of the queue's "size", they're essentially
seen as "void data". they have no size or time associated with them
anyway, so this shouldn't really sound weird.
This commit is contained in:
Ronald S. Bultje 2003-12-13 17:12:46 +00:00
parent 46a70fddfb
commit 90d64117c5
4 changed files with 1214 additions and 800 deletions

File diff suppressed because it is too large Load diff

View file

@ -56,32 +56,37 @@ struct _GstQueue {
GstPad *sinkpad;
GstPad *srcpad;
/* the queue of buffers we're keeping our grubby hands on */
/* the queue of data we're keeping our grubby hands on */
GQueue *queue;
guint level_buffers; /* number of buffers queued here */
guint level_bytes; /* number of bytes queued here */
guint64 level_time; /* amount of time queued here */
struct {
guint buffers; /* no. of buffers */
guint bytes; /* no. of bytes */
guint64 time; /* amount of time */
} cur_level, /* currently in the queue */
max_size, /* max. amount of data allowed in the queue */
min_treshold; /* min. amount of data required to wake reader */
guint size_buffers; /* size of queue in buffers */
guint size_bytes; /* size of queue in bytes */
guint64 size_time; /* size of queue in time */
/* whether we leak data, and at which end */
gint leaky;
/* number of nanoseconds until a blocked queue 'times out'
* to receive data and returns a filler event. -1 = disable */
guint64 block_timeout;
/* it the queue should fail on possible deadlocks */
gboolean may_deadlock;
gint leaky; /* whether the queue is leaky, and if so at which end */
gint block_timeout; /* microseconds until a blocked queue times out and returns GST_EVENT_FILLER.
* A value of -1 will block forever. */
guint min_threshold_bytes; /* the minimum number of bytes required before
* waking up the reader thread */
gboolean may_deadlock; /* it the queue should fail on possible deadlocks */
gboolean interrupt;
gboolean flush;
GMutex *qlock; /* lock for queue (vs object lock) */
GCond *not_empty; /* signals buffers now available for reading */
GCond *not_full; /* signals space now available for writing */
GCond *item_add; /* signals buffers now available for reading */
GCond *item_del; /* signals space now available for writing */
GCond *event_done; /* upstream event signaller */
GTimeVal *timeval; /* the timeout for the queue locking */
GAsyncQueue *events; /* upstream events get decoupled here */
GQueue *events; /* upstream events get decoupled here */
gpointer _gst_reserved[GST_PADDING];
};
@ -89,8 +94,11 @@ struct _GstQueue {
struct _GstQueueClass {
GstElementClass parent_class;
/* signal callbacks */
void (*full) (GstQueue *queue);
/* signals - 'running' is called from both sides
* which might make it sort of non-useful... */
void (*underrun) (GstQueue *queue);
void (*running) (GstQueue *queue);
void (*overrun) (GstQueue *queue);
gpointer _gst_reserved[GST_PADDING];
};

File diff suppressed because it is too large Load diff

View file

@ -56,32 +56,37 @@ struct _GstQueue {
GstPad *sinkpad;
GstPad *srcpad;
/* the queue of buffers we're keeping our grubby hands on */
/* the queue of data we're keeping our grubby hands on */
GQueue *queue;
guint level_buffers; /* number of buffers queued here */
guint level_bytes; /* number of bytes queued here */
guint64 level_time; /* amount of time queued here */
struct {
guint buffers; /* no. of buffers */
guint bytes; /* no. of bytes */
guint64 time; /* amount of time */
} cur_level, /* currently in the queue */
max_size, /* max. amount of data allowed in the queue */
min_treshold; /* min. amount of data required to wake reader */
guint size_buffers; /* size of queue in buffers */
guint size_bytes; /* size of queue in bytes */
guint64 size_time; /* size of queue in time */
/* whether we leak data, and at which end */
gint leaky;
/* number of nanoseconds until a blocked queue 'times out'
* to receive data and returns a filler event. -1 = disable */
guint64 block_timeout;
/* it the queue should fail on possible deadlocks */
gboolean may_deadlock;
gint leaky; /* whether the queue is leaky, and if so at which end */
gint block_timeout; /* microseconds until a blocked queue times out and returns GST_EVENT_FILLER.
* A value of -1 will block forever. */
guint min_threshold_bytes; /* the minimum number of bytes required before
* waking up the reader thread */
gboolean may_deadlock; /* it the queue should fail on possible deadlocks */
gboolean interrupt;
gboolean flush;
GMutex *qlock; /* lock for queue (vs object lock) */
GCond *not_empty; /* signals buffers now available for reading */
GCond *not_full; /* signals space now available for writing */
GCond *item_add; /* signals buffers now available for reading */
GCond *item_del; /* signals space now available for writing */
GCond *event_done; /* upstream event signaller */
GTimeVal *timeval; /* the timeout for the queue locking */
GAsyncQueue *events; /* upstream events get decoupled here */
GQueue *events; /* upstream events get decoupled here */
gpointer _gst_reserved[GST_PADDING];
};
@ -89,8 +94,11 @@ struct _GstQueue {
struct _GstQueueClass {
GstElementClass parent_class;
/* signal callbacks */
void (*full) (GstQueue *queue);
/* signals - 'running' is called from both sides
* which might make it sort of non-useful... */
void (*underrun) (GstQueue *queue);
void (*running) (GstQueue *queue);
void (*overrun) (GstQueue *queue);
gpointer _gst_reserved[GST_PADDING];
};