gst/base/gstbasesink.c (gst_basesink_event): Only wait for the clock and post an...
authorAndy Wingo <wingo@pobox.com>
Fri, 17 Jun 2005 11:33:27 +0000 (11:33 +0000)
committerAndy Wingo <wingo@pobox.com>
Fri, 17 Jun 2005 11:33:27 +0000 (11:33 +0000)
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.

ChangeLog
common
gst/base/gstbasesink.c
libs/gst/base/gstbasesink.c

index f5447f8..2f4d5c8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * gst/elements/gstcapsfilter.c: (gst_capsfilter_class_init),
diff --git a/common b/common
index 495d6e3..d6e46b2 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit 495d6e30b3e513aebbc98467707c609c49ea654d
+Subproject commit d6e46b214fac0ecb46010ff522af2f7653e1c18e
index e714005..7360896 100644 (file)
@@ -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;
     }
index e714005..7360896 100644 (file)
@@ -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;
     }