gst/base/gstbasesink.c: Handle EOS in preroll.

Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_basesink_preroll_queue_push),
(gst_basesink_activate):
Handle EOS in preroll.
This commit is contained in:
Wim Taymans 2005-05-30 15:36:09 +00:00
parent 148057fa10
commit be66bb03b4
3 changed files with 40 additions and 20 deletions

View file

@ -1,3 +1,9 @@
2005-05-30 Wim Taymans <wim@fluendo.com>
* gst/base/gstbasesink.c: (gst_basesink_preroll_queue_push),
(gst_basesink_activate):
Handle EOS in preroll.
2005-05-30 Wim Taymans <wim@fluendo.com>
* gst/gstqueue.c: (gst_queue_handle_sink_event), (gst_queue_chain),

View file

@ -375,6 +375,11 @@ static void
gst_basesink_preroll_queue_push (GstBaseSink * basesink, GstPad * pad,
GstBuffer * buffer)
{
/* if we don't have a buffer we just start blocking */
if (buffer == NULL)
goto block;
/* first buffer */
if (basesink->preroll_queue->length == 0) {
GstBaseSinkClass *bclass = GST_BASESINK_GET_CLASS (basesink);
@ -387,17 +392,19 @@ gst_basesink_preroll_queue_push (GstBaseSink * basesink, GstPad * pad,
if (basesink->preroll_queue->length < basesink->preroll_queue_max_len) {
DEBUG ("push %p %p\n", basesink, buffer);
g_queue_push_tail (basesink->preroll_queue, buffer);
} else {
/* block until the state changes, or we get a flush, or something */
DEBUG ("block %p %p\n", basesink, buffer);
GST_DEBUG ("element %s waiting to finish preroll",
GST_ELEMENT_NAME (basesink));
basesink->need_preroll = FALSE;
basesink->have_preroll = TRUE;
GST_PREROLL_WAIT (pad);
GST_DEBUG ("done preroll");
basesink->have_preroll = FALSE;
return;
}
block:
/* block until the state changes, or we get a flush, or something */
DEBUG ("block %p %p\n", basesink, buffer);
GST_DEBUG ("element %s waiting to finish preroll",
GST_ELEMENT_NAME (basesink));
basesink->need_preroll = FALSE;
basesink->have_preroll = TRUE;
GST_PREROLL_WAIT (pad);
GST_DEBUG ("done preroll");
basesink->have_preroll = FALSE;
}
/* with PREROLL_LOCK */

View file

@ -375,6 +375,11 @@ static void
gst_basesink_preroll_queue_push (GstBaseSink * basesink, GstPad * pad,
GstBuffer * buffer)
{
/* if we don't have a buffer we just start blocking */
if (buffer == NULL)
goto block;
/* first buffer */
if (basesink->preroll_queue->length == 0) {
GstBaseSinkClass *bclass = GST_BASESINK_GET_CLASS (basesink);
@ -387,17 +392,19 @@ gst_basesink_preroll_queue_push (GstBaseSink * basesink, GstPad * pad,
if (basesink->preroll_queue->length < basesink->preroll_queue_max_len) {
DEBUG ("push %p %p\n", basesink, buffer);
g_queue_push_tail (basesink->preroll_queue, buffer);
} else {
/* block until the state changes, or we get a flush, or something */
DEBUG ("block %p %p\n", basesink, buffer);
GST_DEBUG ("element %s waiting to finish preroll",
GST_ELEMENT_NAME (basesink));
basesink->need_preroll = FALSE;
basesink->have_preroll = TRUE;
GST_PREROLL_WAIT (pad);
GST_DEBUG ("done preroll");
basesink->have_preroll = FALSE;
return;
}
block:
/* block until the state changes, or we get a flush, or something */
DEBUG ("block %p %p\n", basesink, buffer);
GST_DEBUG ("element %s waiting to finish preroll",
GST_ELEMENT_NAME (basesink));
basesink->need_preroll = FALSE;
basesink->have_preroll = TRUE;
GST_PREROLL_WAIT (pad);
GST_DEBUG ("done preroll");
basesink->have_preroll = FALSE;
}
/* with PREROLL_LOCK */