libs/gst/base/gstbasesrc.c: Small comment update.
authorWim Taymans <wim.taymans@gmail.com>
Mon, 28 Aug 2006 15:48:24 +0000 (15:48 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Mon, 28 Aug 2006 15:48:24 +0000 (15:48 +0000)
Original commit message from CVS:
* libs/gst/base/gstbasesrc.c: (gst_base_src_perform_seek):
Small comment update.
* plugins/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_transform_ip):
Drop-probability is broken, mention this in the code with a
FIXME and also in the property description.
Make silent also be silent about the drop messages.

ChangeLog
libs/gst/base/gstbasesrc.c
plugins/elements/gstidentity.c

index 844a596..a82b7f5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2006-08-28  Wim Taymans  <wim@fluendo.com>
+
+       * libs/gst/base/gstbasesrc.c: (gst_base_src_perform_seek):
+       Small comment update.
+
+       * plugins/elements/gstidentity.c: (gst_identity_class_init),
+       (gst_identity_transform_ip):
+       Drop-probability is broken, mention this in the code with a 
+       FIXME and also in the property description.
+       Make silent also be silent about the drop messages.
+
 2006-08-28  Tim-Philipp Müller  <tim at centricular dot net>
 
        * docs/manual/appendix-win32.xml:
index e788b34..9be7870 100644 (file)
@@ -855,6 +855,7 @@ gst_base_src_perform_seek (GstBaseSrc * src, GstEvent * event, gboolean unlock)
     GST_DEBUG_OBJECT (src, "closing running segment %" G_GINT64_FORMAT
         " to %" G_GINT64_FORMAT, src->segment.start, src->segment.last_stop);
 
+    /* queue the segment for sending in the stream thread */
     if (src->priv->close_segment)
       gst_event_unref (src->priv->close_segment);
     src->priv->close_segment =
@@ -874,13 +875,16 @@ gst_base_src_perform_seek (GstBaseSrc * src, GstEvent * event, gboolean unlock)
               src->segment.format, src->segment.last_stop));
     }
 
+    /* for deriving a stop position for the playback segment form the seek
+     * segment, we must take the duration when the stop is not set */
     if ((stop = src->segment.stop) == -1)
       stop = src->segment.duration;
 
-    /* now send the newsegment */
     GST_DEBUG_OBJECT (src, "Sending newsegment from %" G_GINT64_FORMAT
         " to %" G_GINT64_FORMAT, src->segment.start, stop);
 
+    /* now replace the old segment so that we send it in the stream thread the
+     * next time it is scheduled. */
     if (src->priv->start_segment)
       gst_event_unref (src->priv->start_segment);
     src->priv->start_segment =
index afc4de7..ca5872b 100644 (file)
@@ -182,7 +182,8 @@ gst_identity_class_init (GstIdentityClass * klass)
           G_MININT, G_MAXINT, DEFAULT_ERROR_AFTER, G_PARAM_READWRITE));
   g_object_class_install_property (gobject_class,
       PROP_DROP_PROBABILITY, g_param_spec_float ("drop_probability",
-          "Drop Probability", "The Probability a buffer is dropped", 0.0, 1.0,
+          "Drop Probability",
+          "The Probability a buffer is dropped (not implemented)", 0.0, 1.0,
           DEFAULT_DROP_PROBABILITY, G_PARAM_READWRITE));
   g_object_class_install_property (gobject_class, PROP_DATARATE,
       g_param_spec_int ("datarate", "Datarate",
@@ -364,19 +365,24 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
 
   if (identity->drop_probability > 0.0) {
     if ((gfloat) (1.0 * rand () / (RAND_MAX)) < identity->drop_probability) {
-      GST_OBJECT_LOCK (identity);
-      g_free (identity->last_message);
-      identity->last_message =
-          g_strdup_printf ("dropping   ******* (%s:%s)i (%d bytes, timestamp: %"
-          GST_TIME_FORMAT ", duration: %" GST_TIME_FORMAT ", offset: %"
-          G_GINT64_FORMAT ", offset_end: % " G_GINT64_FORMAT ", flags: %d) %p",
-          GST_DEBUG_PAD_NAME (trans->sinkpad), GST_BUFFER_SIZE (buf),
-          GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
-          GST_TIME_ARGS (GST_BUFFER_DURATION (buf)),
-          GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf),
-          GST_BUFFER_FLAGS (buf), buf);
-      GST_OBJECT_UNLOCK (identity);
-      g_object_notify (G_OBJECT (identity), "last-message");
+      if (!identity->silent) {
+        GST_OBJECT_LOCK (identity);
+        g_free (identity->last_message);
+        identity->last_message =
+            g_strdup_printf
+            ("dropping   ******* (%s:%s)i (%d bytes, timestamp: %"
+            GST_TIME_FORMAT ", duration: %" GST_TIME_FORMAT ", offset: %"
+            G_GINT64_FORMAT ", offset_end: % " G_GINT64_FORMAT
+            ", flags: %d) %p", GST_DEBUG_PAD_NAME (trans->sinkpad),
+            GST_BUFFER_SIZE (buf), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
+            GST_TIME_ARGS (GST_BUFFER_DURATION (buf)), GST_BUFFER_OFFSET (buf),
+            GST_BUFFER_OFFSET_END (buf), GST_BUFFER_FLAGS (buf), buf);
+        GST_OBJECT_UNLOCK (identity);
+        g_object_notify (G_OBJECT (identity), "last-message");
+      }
+      /* FIXME, this does not drop the buffer in basetransform. Actually
+       * dropping the buffer in transform_ip is not possible without a new
+       * custom GstFlowReturn value. */
       return GST_FLOW_OK;
     }
   }