Index: libs/gst/base/gstbasesrc.c
===================================================================
RCS file: /cvs/gstreamer/gstreamer/libs/gst/base/gstbasesrc.c,v
retrieving revision 1.94
diff -u -p -r1.94 gstbasesrc.c
--- libs/gst/base/gstbasesrc.c	13 Feb 2006 11:52:42 -0000	1.94
+++ libs/gst/base/gstbasesrc.c	13 Feb 2006 15:30:25 -0000
@@ -151,6 +151,13 @@ enum
   PROP_TYPEFIND,
 };
 
+#define GST_BASE_SRC_GET_PRIVATE(obj)  \
+   (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_BASE_SRC, GstBaseSrcPrivate))
+
+typedef struct _GstBaseSrcPrivate {
+  gboolean  last_sent_eos; /* last thing we did was send an EOS */
+} GstBaseSrcPrivate;
+
 static GstElementClass *parent_class = NULL;
 
 static void gst_base_src_base_init (gpointer g_class);
@@ -231,6 +238,8 @@ gst_base_src_class_init (GstBaseSrcClass
   gobject_class = (GObjectClass *) klass;
   gstelement_class = (GstElementClass *) klass;
 
+  g_type_class_add_private (klass, sizeof (GstBaseSrcPrivate));
+
   parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
 
   gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_base_src_finalize);
@@ -1228,6 +1237,7 @@ gst_base_src_check_get_range (GstPad * p
 static void
 gst_base_src_loop (GstPad * pad)
 {
+  GstBaseSrcPrivate *priv;
   GstBaseSrc *src;
   GstBuffer *buf = NULL;
   GstFlowReturn ret;
@@ -1235,6 +1245,9 @@ gst_base_src_loop (GstPad * pad)
 
   src = GST_BASE_SRC (gst_pad_get_parent (pad));
 
+  priv = GST_BASE_SRC_GET_PRIVATE (src);
+  priv->last_sent_eos = FALSE;
+
   /* if we operate in bytes, we can calculate an offset */
   if (src->segment.format == GST_FORMAT_BYTES)
     position = src->segment.last_stop;
@@ -1303,6 +1316,7 @@ eos:
               src->segment.format, src->segment.last_stop));
     } else {
       gst_pad_push_event (pad, gst_event_new_eos ());
+      priv->last_sent_eos = TRUE;
     }
     goto done;
   }
@@ -1318,6 +1332,7 @@ pause:
           (_("Internal data flow error.")),
           ("streaming task paused, reason %s", reason));
       gst_pad_push_event (pad, gst_event_new_eos ());
+      priv->last_sent_eos = TRUE;
     }
     goto done;
   }
@@ -1329,6 +1344,7 @@ error:
     src->data.ABI.running = FALSE;
     gst_pad_pause_task (pad);
     gst_pad_push_event (pad, gst_event_new_eos ());
+    priv->last_sent_eos = TRUE;
     goto done;
   }
 }
@@ -1718,11 +1734,19 @@ gst_base_src_change_state (GstElement * 
       }
       GST_LIVE_UNLOCK (element);
       break;
-    case GST_STATE_CHANGE_PAUSED_TO_READY:
+    case GST_STATE_CHANGE_PAUSED_TO_READY: {
+      GstBaseSrcPrivate *priv;
+
       if (!gst_base_src_stop (basesrc))
         goto error_stop;
-      gst_pad_push_event (basesrc->srcpad, gst_event_new_eos ());
+
+      priv = GST_BASE_SRC_GET_PRIVATE (basesrc);
+      if (!priv->last_sent_eos) {
+        gst_pad_push_event (basesrc->srcpad, gst_event_new_eos ());
+        priv->last_sent_eos = TRUE;
+      }
       break;
+    }
     case GST_STATE_CHANGE_READY_TO_NULL:
       break;
     default:
