gst/gstbuffer.c: gst_buffer_span should copy the timestamp of the first buffer if they were both originally overlappi...

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.
This commit is contained in:
Jan Schmidt 2006-01-12 16:07:50 +00:00
parent 4159740e17
commit 3b1dfa5fec
2 changed files with 26 additions and 18 deletions

View file

@ -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):

View 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);
}
}
}