role of timestamp in GstBuffer

Massimiliano Cialdi massimiliano.cialdi at powersoft.it
Mon Feb 4 07:53:56 PST 2013


hallo,

trying to make a test I noticed a strange behavior of timestamp in 
GstBuffer.

here is a simplified chain function:

/* chain function
  * this function does the actual processing
  */
static GstFlowReturn
gst_myconverter_chain (GstPad * pad, GstBuffer * buf)
{
     Gstmyconverter *filter;
     GstFlowReturn ret;

     filter = GST_MYCONVERTER (GST_OBJECT_PARENT (pad));

     GstBuffer     *outBuf;
     outBuf = (GstBuffer*)gst_buffer_copy(buf);

     guint          numSamples;

     numSamples = 
(GST_BUFFER_SIZE(buf)/(filter->stream.width/8))/filter->stream.channels;

     GST_BUFFER_DURATION (outBuf) = GST_FRAMES_TO_CLOCK_TIME(numSamples, 
filter->stream.sampleRate);

     filter->totalDuration  += GST_BUFFER_DURATION (outBuf);

     if(filter->useTimeStamp)
         GST_BUFFER_TIMESTAMP(outBuf)    = filter->totalDuration;
     else
         GST_BUFFER_TIMESTAMP(outBuf)    = GST_CLOCK_TIME_NONE;

     ret = gst_pad_push (filter->srcpad, outBuf);
     gst_buffer_unref(buf);

     return ret;
}


that is, if timestamp is GST_CLOCK_TIME_NONE it works well.
If timestamp is actual elapsed time it doesnt works. It seems to be much 
faster.

why this behaviour?
what is the correct value to be assigned to timestamp?

best regards

Max
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gstmyconverter.h
Type: text/x-chdr
Size: 3482 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20130204/94d4b088/attachment.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gstmyconverter.c
Type: text/x-csrc
Size: 10876 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20130204/94d4b088/attachment.c>


More information about the gstreamer-devel mailing list