only update the DURATION field when appending buffers and both buffers have a valid duration.

Original commit message from CVS:
only update the DURATION field when appending buffers and both buffers
have a valid duration.
This commit is contained in:
Wim Taymans 2003-05-24 11:04:57 +00:00
parent a4f13fb2be
commit a4df733d52
2 changed files with 7 additions and 2 deletions

View file

@ -452,8 +452,12 @@ gst_buffer_span (GstBuffer *buf1, guint32 offset, GstBuffer *buf2, guint32 len)
} }
} }
/* if we completely merged the two buffers (appended), we can /* if we completely merged the two buffers (appended), we can
* calculate the duration too */ * calculate the duration too. Also make sure we's not messing with
if (offset == 0 && buf1->size + buf2->size == len) { * invalid DURATIONS */
if (offset == 0 && buf1->size + buf2->size == len &&
GST_BUFFER_DURATION_IS_VALID (buf1) &&
GST_BUFFER_DURATION_IS_VALID (buf2))
{
/* add duration */ /* add duration */
GST_BUFFER_DURATION (newbuf) = GST_BUFFER_DURATION (buf1) + GST_BUFFER_DURATION (newbuf) = GST_BUFFER_DURATION (buf1) +
GST_BUFFER_DURATION (buf2); GST_BUFFER_DURATION (buf2);

View file

@ -69,6 +69,7 @@ extern GType _gst_buffer_pool_type;
#define GST_BUFFER_OFFSET_NONE ((guint64)-1) #define GST_BUFFER_OFFSET_NONE ((guint64)-1)
#define GST_BUFFER_MAXSIZE_NONE ((guint)0) #define GST_BUFFER_MAXSIZE_NONE ((guint)0)
#define GST_BUFFER_DURATION_IS_VALID(buffer) (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DURATION (buffer)))
#define GST_BUFFER_TIMESTAMP_IS_VALID(buffer) (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buffer))) #define GST_BUFFER_TIMESTAMP_IS_VALID(buffer) (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buffer)))
#define GST_BUFFER_OFFSET_IS_VALID(buffer) (GST_BUFFER_OFFSET (buffer) != GST_BUFFER_OFFSET_NONE) #define GST_BUFFER_OFFSET_IS_VALID(buffer) (GST_BUFFER_OFFSET (buffer) != GST_BUFFER_OFFSET_NONE)
#define GST_BUFFER_MAXSIZE_IS_VALID(buffer) (GST_BUFFER_MAXSIZE (buffer) != GST_BUFFER_MAXSIZE_NONE) #define GST_BUFFER_MAXSIZE_IS_VALID(buffer) (GST_BUFFER_MAXSIZE (buffer) != GST_BUFFER_MAXSIZE_NONE)