From be66bb03b49ca7f7e77bceb1f51cc514e75d8dc1 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 30 May 2005 15:36:09 +0000 Subject: [PATCH] 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. --- ChangeLog | 6 ++++++ gst/base/gstbasesink.c | 27 +++++++++++++++++---------- libs/gst/base/gstbasesink.c | 27 +++++++++++++++++---------- 3 files changed, 40 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2383c1f..2f2914d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2005-05-30 Wim Taymans + * gst/base/gstbasesink.c: (gst_basesink_preroll_queue_push), + (gst_basesink_activate): + Handle EOS in preroll. + +2005-05-30 Wim Taymans + * gst/gstqueue.c: (gst_queue_handle_sink_event), (gst_queue_chain), (gst_queue_loop), (gst_queue_handle_src_event): Remove old pieces of code diff --git a/gst/base/gstbasesink.c b/gst/base/gstbasesink.c index b8604c8..b6dc5f2 100644 --- a/gst/base/gstbasesink.c +++ b/gst/base/gstbasesink.c @@ -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 */ diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c index b8604c8..b6dc5f2 100644 --- a/libs/gst/base/gstbasesink.c +++ b/libs/gst/base/gstbasesink.c @@ -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 */ -- 2.7.4