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),
(gst_queue_loop), (gst_queue_handle_src_event):
Remove old pieces of code
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);
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 */
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);
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 */