gst/gstbuffer.c: gst_buffer_span should copy the timestamp of the first buffer if...
authorJan Schmidt <thaytan@mad.scientist.com>
Thu, 12 Jan 2006 16:07:50 +0000 (16:07 +0000)
committerJan Schmidt <thaytan@mad.scientist.com>
Thu, 12 Jan 2006 16:07:50 +0000 (16:07 +0000)
Original commit message from CVS:
* gst/gstbuffer.c: (gst_buffer_span):
gst_buffer_span should copy the timestamp of the first buffer
if they were both originally overlapping subbuffers of the
same parent, using the same logic as the 'slow copy' case.

ChangeLog
gst/gstbuffer.c

index fb12dc0..cc398d9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-01-12  Jan Schmidt  <thaytan@mad.scientist.com>
+
+       * gst/gstbuffer.c: (gst_buffer_span):
+         gst_buffer_span should copy the timestamp of the first buffer
+         if they were both originally overlapping subbuffers of the 
+         same parent, using the same logic as the 'slow copy' case.
+
 2006-01-11  Jan Schmidt  <thaytan@mad.scientist.com>
 
        * libs/gst/base/gstcollectpads.c: (gst_collect_pads_pop):
index 442126d..684ef8e 100644 (file)
@@ -553,25 +553,26 @@ gst_buffer_span (GstBuffer * buf1, guint32 offset, GstBuffer * buf2,
     /* copy the second buffer's data across */
     memcpy (newbuf->data + (buf1->size - offset), buf2->data,
         len - (buf1->size - offset));
-    /* if the offset is 0, the new buffer has the same timestamp as buf1 */
-    if (offset == 0) {
-      GST_BUFFER_OFFSET (newbuf) = GST_BUFFER_OFFSET (buf1);
-      GST_BUFFER_TIMESTAMP (newbuf) = GST_BUFFER_TIMESTAMP (buf1);
-    }
   }
-  /* if we completely merged the two buffers (appended), we can
-   * calculate the duration too. Also make sure we's not messing with
-   * invalid DURATIONS */
-  if (offset == 0 && buf1->size + buf2->size == len) {
-    if (GST_BUFFER_DURATION_IS_VALID (buf1) &&
-        GST_BUFFER_DURATION_IS_VALID (buf2)) {
-      /* add duration */
-      GST_BUFFER_DURATION (newbuf) = GST_BUFFER_DURATION (buf1) +
-          GST_BUFFER_DURATION (buf2);
-    }
-    if (GST_BUFFER_OFFSET_END_IS_VALID (buf2)) {
-      /* add offset_end */
-      GST_BUFFER_OFFSET_END (newbuf) = GST_BUFFER_OFFSET_END (buf2);
+  /* if the offset is 0, the new buffer has the same timestamp as buf1 */
+  if (offset == 0) {
+    GST_BUFFER_OFFSET (newbuf) = GST_BUFFER_OFFSET (buf1);
+    GST_BUFFER_TIMESTAMP (newbuf) = GST_BUFFER_TIMESTAMP (buf1);
+
+    /* if we completely merged the two buffers (appended), we can
+     * calculate the duration too. Also make sure we's not messing with
+     * invalid DURATIONS */
+    if (buf1->size + buf2->size == len) {
+      if (GST_BUFFER_DURATION_IS_VALID (buf1) &&
+          GST_BUFFER_DURATION_IS_VALID (buf2)) {
+        /* add duration */
+        GST_BUFFER_DURATION (newbuf) = GST_BUFFER_DURATION (buf1) +
+            GST_BUFFER_DURATION (buf2);
+      }
+      if (GST_BUFFER_OFFSET_END_IS_VALID (buf2)) {
+        /* add offset_end */
+        GST_BUFFER_OFFSET_END (newbuf) = GST_BUFFER_OFFSET_END (buf2);
+      }
     }
   }