plugins/elements/gstmultiqueue.c: Update queue state _after_ adding the item in the queue because else we could end u...

Original commit message from CVS:
* plugins/elements/gstmultiqueue.c: (gst_single_queue_flush),
(gst_multi_queue_chain), (gst_multi_queue_sink_event):
Update queue state _after_ adding the item in the queue because else we
could end up being full without the element added yet.
This commit is contained in:
Wim Taymans 2007-06-18 15:15:32 +00:00
parent 0b3153873b
commit 8fb713783b
2 changed files with 22 additions and 10 deletions

View file

@ -1,3 +1,10 @@
2007-06-18 Wim Taymans <wim@fluendo.com>
* plugins/elements/gstmultiqueue.c: (gst_single_queue_flush),
(gst_multi_queue_chain), (gst_multi_queue_sink_event):
Update queue state _after_ adding the item in the queue because else we
could end up being full without the element added yet.
2007-06-18 Wim Taymans <wim@fluendo.com>
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),

View file

@ -446,6 +446,7 @@ gst_single_queue_flush (GstMultiQueue * mq, GstSingleQueue * sq, gboolean flush)
gst_segment_init (&sq->sink_segment, GST_FORMAT_TIME);
gst_segment_init (&sq->src_segment, GST_FORMAT_TIME);
sq->srcresult = GST_FLOW_OK;
sq->cur_time = 0;
sq->max_size.visible = mq->max_size.visible;
sq->is_eos = FALSE;
sq->inextra = FALSE;
@ -760,12 +761,13 @@ gst_multi_queue_chain (GstPad * pad, GstBuffer * buffer)
item = gst_multi_queue_item_new (GST_MINI_OBJECT_CAST (buffer), curid);
/* update time level */
apply_buffer (mq, sq, buffer, &sq->sink_segment);
if (!(gst_data_queue_push (sq->queue, (GstDataQueueItem *) item)))
goto flushing;
/* update time level, we must do this after pushing the data in the queue so
* that we never end up filling the queue first. */
apply_buffer (mq, sq, buffer, &sq->sink_segment);
done:
gst_object_unref (mq);
@ -832,10 +834,6 @@ gst_multi_queue_sink_event (GstPad * pad, GstEvent * event)
gst_single_queue_flush (mq, sq, FALSE);
goto done;
case GST_EVENT_NEWSEGMENT:
apply_segment (mq, sq, event, &sq->sink_segment);
break;
default:
if (!(GST_EVENT_IS_SERIALIZED (event))) {
res = gst_pad_push_event (sq->srcpad, event);
@ -862,9 +860,16 @@ gst_multi_queue_sink_event (GstPad * pad, GstEvent * event)
* buffer in the queue because EOS marks the buffer as filled. No need to take
* a lock, the _check_full happens from this thread only, right before pushing
* into dataqueue. */
if (type == GST_EVENT_EOS)
sq->is_eos = TRUE;
switch (type) {
case GST_EVENT_EOS:
sq->is_eos = TRUE;
break;
case GST_EVENT_NEWSEGMENT:
apply_segment (mq, sq, event, &sq->sink_segment);
break;
default:
break;
}
done:
gst_object_unref (mq);
return res;