From d0ce1ff675424fe5b42f491cabedc47bd5cc8150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 6 Jun 2010 15:29:34 +0200 Subject: [PATCH] rtmpsrc: Improve timestamp handling a bit --- ext/rtmp/gstrtmpsrc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ext/rtmp/gstrtmpsrc.c b/ext/rtmp/gstrtmpsrc.c index ebee88cf6e..91ce4e3dfc 100644 --- a/ext/rtmp/gstrtmpsrc.c +++ b/ext/rtmp/gstrtmpsrc.c @@ -335,6 +335,8 @@ gst_rtmp_src_create (GstPushSrc * pushsrc, GstBuffer ** buffer) data = GST_BUFFER_DATA (buf); read = 0; + src->last_timestamp = + MAX (src->last_timestamp, src->rtmp->m_mediaStamp * GST_MSECOND); while (todo > 0) { read = RTMP_Read (src->rtmp, (char *) data, todo); @@ -363,15 +365,16 @@ gst_rtmp_src_create (GstPushSrc * pushsrc, GstBuffer ** buffer) src->discont = FALSE; } - src->last_timestamp = - MAX (src->last_timestamp, src->rtmp->m_mediaStamp * GST_MSECOND); GST_BUFFER_TIMESTAMP (buf) = src->last_timestamp; GST_BUFFER_OFFSET (buf) = src->cur_offset; + + src->last_timestamp = + MAX (src->last_timestamp, src->rtmp->m_mediaStamp * GST_MSECOND); src->cur_offset += size; GST_LOG_OBJECT (src, "Created buffer of size %u at %" G_GINT64_FORMAT " with timestamp %" GST_TIME_FORMAT, size, GST_BUFFER_OFFSET (buf), - GST_TIME_ARGS (src->last_timestamp)); + GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf))); /* we're done, return the buffer */