From: Wim Taymans Date: Wed, 29 Jun 2005 10:24:08 +0000 (+0000) Subject: gst/base/gstbasesink.c: We are actually prerolling before commiting the state change. X-Git-Tag: RELEASE-0_9_2~338 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a34bc0bd60ba8926c3a8e1f24d61b8b7bf1623f9;p=platform%2Fupstream%2Fgstreamer.git gst/base/gstbasesink.c: We are actually prerolling before commiting the state change. Original commit message from CVS: * gst/base/gstbasesink.c: (gst_base_sink_handle_object): We are actually prerolling before commiting the state change. --- diff --git a/ChangeLog b/ChangeLog index 27cf1ff..848573e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-06-29 Wim Taymans + + * gst/base/gstbasesink.c: (gst_base_sink_handle_object): + We are actually prerolling before commiting the state + change. + 2005-06-29 Ronald S. Bultje * docs/manual/advanced-clocks.xml: diff --git a/gst/base/gstbasesink.c b/gst/base/gstbasesink.c index 27a0c2f..d7f53dc 100644 --- a/gst/base/gstbasesink.c +++ b/gst/base/gstbasesink.c @@ -461,6 +461,7 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad, } /* we are prerolling */ GST_DEBUG ("finish preroll %p >", basesink); + basesink->have_preroll = TRUE; GST_PREROLL_UNLOCK (pad); /* have to release STREAM_LOCK as we cannot take the STATE_LOCK @@ -483,13 +484,14 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad, if (t > 0) GST_STREAM_LOCK_FULL (pad, t); + /* and wait if needed */ + GST_PREROLL_LOCK (pad); + GST_LOCK (pad); if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad))) goto flushing; GST_UNLOCK (pad); - /* and wait if needed */ - GST_PREROLL_LOCK (pad); /* it is possible that the application set the state to PLAYING * now in which case we don't need to block anymore. */ if (!basesink->need_preroll) @@ -504,18 +506,17 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad, /* block until the state changes, or we get a flush, or something */ GST_DEBUG ("element %s waiting to finish preroll", GST_ELEMENT_NAME (basesink)); - basesink->have_preroll = TRUE; GST_PREROLL_WAIT (pad); GST_DEBUG ("done preroll"); basesink->have_preroll = FALSE; } - GST_PREROLL_UNLOCK (pad); - GST_LOCK (pad); if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad))) goto flushing; GST_UNLOCK (pad); + GST_PREROLL_UNLOCK (pad); + return GST_FLOW_OK; no_preroll: @@ -525,6 +526,7 @@ no_preroll: GST_DEBUG ("no preroll needed"); /* maybe it was another sink that blocked in preroll, need to check for buffers to drain */ + basesink->have_preroll = FALSE; ret = gst_base_sink_preroll_queue_empty (basesink, pad); GST_PREROLL_UNLOCK (pad); @@ -533,6 +535,8 @@ no_preroll: flushing: { GST_UNLOCK (pad); + basesink->have_preroll = FALSE; + GST_PREROLL_UNLOCK (pad); GST_DEBUG ("pad is flushing"); return GST_FLOW_WRONG_STATE; } diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c index 27a0c2f..d7f53dc 100644 --- a/libs/gst/base/gstbasesink.c +++ b/libs/gst/base/gstbasesink.c @@ -461,6 +461,7 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad, } /* we are prerolling */ GST_DEBUG ("finish preroll %p >", basesink); + basesink->have_preroll = TRUE; GST_PREROLL_UNLOCK (pad); /* have to release STREAM_LOCK as we cannot take the STATE_LOCK @@ -483,13 +484,14 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad, if (t > 0) GST_STREAM_LOCK_FULL (pad, t); + /* and wait if needed */ + GST_PREROLL_LOCK (pad); + GST_LOCK (pad); if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad))) goto flushing; GST_UNLOCK (pad); - /* and wait if needed */ - GST_PREROLL_LOCK (pad); /* it is possible that the application set the state to PLAYING * now in which case we don't need to block anymore. */ if (!basesink->need_preroll) @@ -504,18 +506,17 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad, /* block until the state changes, or we get a flush, or something */ GST_DEBUG ("element %s waiting to finish preroll", GST_ELEMENT_NAME (basesink)); - basesink->have_preroll = TRUE; GST_PREROLL_WAIT (pad); GST_DEBUG ("done preroll"); basesink->have_preroll = FALSE; } - GST_PREROLL_UNLOCK (pad); - GST_LOCK (pad); if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad))) goto flushing; GST_UNLOCK (pad); + GST_PREROLL_UNLOCK (pad); + return GST_FLOW_OK; no_preroll: @@ -525,6 +526,7 @@ no_preroll: GST_DEBUG ("no preroll needed"); /* maybe it was another sink that blocked in preroll, need to check for buffers to drain */ + basesink->have_preroll = FALSE; ret = gst_base_sink_preroll_queue_empty (basesink, pad); GST_PREROLL_UNLOCK (pad); @@ -533,6 +535,8 @@ no_preroll: flushing: { GST_UNLOCK (pad); + basesink->have_preroll = FALSE; + GST_PREROLL_UNLOCK (pad); GST_DEBUG ("pad is flushing"); return GST_FLOW_WRONG_STATE; }