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  <wingo@pobox.com>

* 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.
This commit is contained in:
Andy Wingo 2005-06-17 11:33:27 +00:00
parent 85df008efe
commit d47ea57975
4 changed files with 63 additions and 49 deletions

View file

@ -1,3 +1,9 @@
2005-06-17 Andy Wingo <wingo@pobox.com>
* 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 <ds@schleef.org> 2005-06-16 David Schleef <ds@schleef.org>
* gst/elements/gstcapsfilter.c: (gst_capsfilter_class_init), * gst/elements/gstcapsfilter.c: (gst_capsfilter_class_init),

2
common

@ -1 +1 @@
Subproject commit 495d6e30b3e513aebbc98467707c609c49ea654d Subproject commit d6e46b214fac0ecb46010ff522af2f7653e1c18e

View file

@ -534,41 +534,45 @@ gst_basesink_event (GstPad * pad, GstEvent * event)
switch (GST_EVENT_TYPE (event)) { switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS: case GST_EVENT_EOS:
{ {
PrerollReturn pre_ret;
gboolean need_eos; gboolean need_eos;
GST_STREAM_LOCK (pad); GST_STREAM_LOCK (pad);
/* EOS also finishes the preroll */ /* EOS also finishes the preroll */
gst_basesink_finish_preroll (basesink, pad, NULL); pre_ret = gst_basesink_finish_preroll (basesink, pad, NULL);
GST_LOCK (basesink); if (pre_ret == PREROLL_PLAYING) {
need_eos = basesink->eos = TRUE; GST_LOCK (basesink);
if (basesink->clock) { need_eos = basesink->eos = TRUE;
/* wait for last buffer to finish if we have a valid end time */ if (basesink->clock) {
if (GST_CLOCK_TIME_IS_VALID (basesink->end_time)) { /* wait for last buffer to finish if we have a valid end time */
basesink->clock_id = gst_clock_new_single_shot_id (basesink->clock, if (GST_CLOCK_TIME_IS_VALID (basesink->end_time)) {
basesink->end_time + GST_ELEMENT (basesink)->base_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_UNLOCK (basesink);
gst_clock_id_wait (basesink->clock_id, NULL); /* if we are still EOS, we can post the EOS message */
if (need_eos) {
GST_LOCK (basesink); /* ok, now we can post the message */
if (basesink->clock_id) { gst_element_post_message (GST_ELEMENT (basesink),
gst_clock_id_unref (basesink->clock_id); gst_message_new_eos (GST_OBJECT (basesink)));
basesink->clock_id = NULL;
} }
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); GST_STREAM_UNLOCK (pad);
break; break;
} }

View file

@ -534,41 +534,45 @@ gst_basesink_event (GstPad * pad, GstEvent * event)
switch (GST_EVENT_TYPE (event)) { switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS: case GST_EVENT_EOS:
{ {
PrerollReturn pre_ret;
gboolean need_eos; gboolean need_eos;
GST_STREAM_LOCK (pad); GST_STREAM_LOCK (pad);
/* EOS also finishes the preroll */ /* EOS also finishes the preroll */
gst_basesink_finish_preroll (basesink, pad, NULL); pre_ret = gst_basesink_finish_preroll (basesink, pad, NULL);
GST_LOCK (basesink); if (pre_ret == PREROLL_PLAYING) {
need_eos = basesink->eos = TRUE; GST_LOCK (basesink);
if (basesink->clock) { need_eos = basesink->eos = TRUE;
/* wait for last buffer to finish if we have a valid end time */ if (basesink->clock) {
if (GST_CLOCK_TIME_IS_VALID (basesink->end_time)) { /* wait for last buffer to finish if we have a valid end time */
basesink->clock_id = gst_clock_new_single_shot_id (basesink->clock, if (GST_CLOCK_TIME_IS_VALID (basesink->end_time)) {
basesink->end_time + GST_ELEMENT (basesink)->base_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_UNLOCK (basesink);
gst_clock_id_wait (basesink->clock_id, NULL); /* if we are still EOS, we can post the EOS message */
if (need_eos) {
GST_LOCK (basesink); /* ok, now we can post the message */
if (basesink->clock_id) { gst_element_post_message (GST_ELEMENT (basesink),
gst_clock_id_unref (basesink->clock_id); gst_message_new_eos (GST_OBJECT (basesink)));
basesink->clock_id = NULL;
} }
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); GST_STREAM_UNLOCK (pad);
break; break;
} }