+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>
* gst/elements/gstcapsfilter.c: (gst_capsfilter_class_init),
-Subproject commit 495d6e30b3e513aebbc98467707c609c49ea654d
+Subproject commit d6e46b214fac0ecb46010ff522af2f7653e1c18e
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;
}
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;
}