From: Andy Wingo Date: Fri, 17 Jun 2005 11:33:27 +0000 (+0000) Subject: gst/base/gstbasesink.c (gst_basesink_event): Only wait for the clock and post an... X-Git-Tag: RELEASE-0_9_2~414 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d47ea57975a88e81e170fd4bcdfa6a6973e63e7b;p=platform%2Fupstream%2Fgstreamer.git gst/base/gstbasesink.c (gst_basesink_event): Only wait for the clock and post an EOS message if we come out of finish... Original commit message from CVS: 2005-06-17 Andy Wingo * gst/base/gstbasesink.c (gst_basesink_event): Only wait for the clock and post an EOS message if we come out of finish_preroll in the playing state. --- diff --git a/ChangeLog b/ChangeLog index f5447f8..2f4d5c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-06-17 Andy Wingo + + * gst/base/gstbasesink.c (gst_basesink_event): Only wait for the + clock and post an EOS message if we come out of finish_preroll in + the playing state. + 2005-06-16 David Schleef * gst/elements/gstcapsfilter.c: (gst_capsfilter_class_init), diff --git a/common b/common index 495d6e3..d6e46b2 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 495d6e30b3e513aebbc98467707c609c49ea654d +Subproject commit d6e46b214fac0ecb46010ff522af2f7653e1c18e diff --git a/gst/base/gstbasesink.c b/gst/base/gstbasesink.c index e714005..7360896 100644 --- a/gst/base/gstbasesink.c +++ b/gst/base/gstbasesink.c @@ -534,41 +534,45 @@ gst_basesink_event (GstPad * pad, GstEvent * event) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_EOS: { + PrerollReturn pre_ret; gboolean need_eos; GST_STREAM_LOCK (pad); /* EOS also finishes the preroll */ - gst_basesink_finish_preroll (basesink, pad, NULL); + pre_ret = gst_basesink_finish_preroll (basesink, pad, NULL); - GST_LOCK (basesink); - need_eos = basesink->eos = TRUE; - if (basesink->clock) { - /* wait for last buffer to finish if we have a valid end time */ - if (GST_CLOCK_TIME_IS_VALID (basesink->end_time)) { - basesink->clock_id = gst_clock_new_single_shot_id (basesink->clock, - basesink->end_time + GST_ELEMENT (basesink)->base_time); + if (pre_ret == PREROLL_PLAYING) { + GST_LOCK (basesink); + need_eos = basesink->eos = TRUE; + if (basesink->clock) { + /* wait for last buffer to finish if we have a valid end time */ + if (GST_CLOCK_TIME_IS_VALID (basesink->end_time)) { + basesink->clock_id = gst_clock_new_single_shot_id (basesink->clock, + basesink->end_time + GST_ELEMENT (basesink)->base_time); + GST_UNLOCK (basesink); + + gst_clock_id_wait (basesink->clock_id, NULL); + + GST_LOCK (basesink); + if (basesink->clock_id) { + gst_clock_id_unref (basesink->clock_id); + basesink->clock_id = NULL; + } + basesink->end_time = GST_CLOCK_TIME_NONE; + need_eos = basesink->eos; + } GST_UNLOCK (basesink); - gst_clock_id_wait (basesink->clock_id, NULL); - - GST_LOCK (basesink); - if (basesink->clock_id) { - gst_clock_id_unref (basesink->clock_id); - basesink->clock_id = NULL; + /* if we are still EOS, we can post the EOS message */ + if (need_eos) { + /* ok, now we can post the message */ + gst_element_post_message (GST_ELEMENT (basesink), + gst_message_new_eos (GST_OBJECT (basesink))); } - basesink->end_time = GST_CLOCK_TIME_NONE; - need_eos = basesink->eos; - } - GST_UNLOCK (basesink); - - /* if we are still EOS, we can post the EOS message */ - if (need_eos) { - /* ok, now we can post the message */ - gst_element_post_message (GST_ELEMENT (basesink), - gst_message_new_eos (GST_OBJECT (basesink))); } } + GST_STREAM_UNLOCK (pad); break; } diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c index e714005..7360896 100644 --- a/libs/gst/base/gstbasesink.c +++ b/libs/gst/base/gstbasesink.c @@ -534,41 +534,45 @@ gst_basesink_event (GstPad * pad, GstEvent * event) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_EOS: { + PrerollReturn pre_ret; gboolean need_eos; GST_STREAM_LOCK (pad); /* EOS also finishes the preroll */ - gst_basesink_finish_preroll (basesink, pad, NULL); + pre_ret = gst_basesink_finish_preroll (basesink, pad, NULL); - GST_LOCK (basesink); - need_eos = basesink->eos = TRUE; - if (basesink->clock) { - /* wait for last buffer to finish if we have a valid end time */ - if (GST_CLOCK_TIME_IS_VALID (basesink->end_time)) { - basesink->clock_id = gst_clock_new_single_shot_id (basesink->clock, - basesink->end_time + GST_ELEMENT (basesink)->base_time); + if (pre_ret == PREROLL_PLAYING) { + GST_LOCK (basesink); + need_eos = basesink->eos = TRUE; + if (basesink->clock) { + /* wait for last buffer to finish if we have a valid end time */ + if (GST_CLOCK_TIME_IS_VALID (basesink->end_time)) { + basesink->clock_id = gst_clock_new_single_shot_id (basesink->clock, + basesink->end_time + GST_ELEMENT (basesink)->base_time); + GST_UNLOCK (basesink); + + gst_clock_id_wait (basesink->clock_id, NULL); + + GST_LOCK (basesink); + if (basesink->clock_id) { + gst_clock_id_unref (basesink->clock_id); + basesink->clock_id = NULL; + } + basesink->end_time = GST_CLOCK_TIME_NONE; + need_eos = basesink->eos; + } GST_UNLOCK (basesink); - gst_clock_id_wait (basesink->clock_id, NULL); - - GST_LOCK (basesink); - if (basesink->clock_id) { - gst_clock_id_unref (basesink->clock_id); - basesink->clock_id = NULL; + /* if we are still EOS, we can post the EOS message */ + if (need_eos) { + /* ok, now we can post the message */ + gst_element_post_message (GST_ELEMENT (basesink), + gst_message_new_eos (GST_OBJECT (basesink))); } - basesink->end_time = GST_CLOCK_TIME_NONE; - need_eos = basesink->eos; - } - GST_UNLOCK (basesink); - - /* if we are still EOS, we can post the EOS message */ - if (need_eos) { - /* ok, now we can post the message */ - gst_element_post_message (GST_ELEMENT (basesink), - gst_message_new_eos (GST_OBJECT (basesink))); } } + GST_STREAM_UNLOCK (pad); break; }