correct handling of BUFFER_PTS pushed to appsrc

DuĊĦan Poizl poizl at maindata.sk
Tue Nov 18 03:41:12 PST 2014


Hello I am still confused by how to calculate PTS for buffer which is
pushed to appsrc.

First approach is set PTS to
gst_clock_get_time(GST_ELEMENT_CLOCK(appsrc))-gst_element_get_base_time(appsrc);
But this result in constant needData callback.

Second approach is calculate PTS manually by
frame*GST_SECOND*fps_denom/fps_num where I increase frame by one for
each frame which is pushed. This result in five-six needData callback at
start and then it keep going. This seems to work but now the problem is
synchronisation with audio. It seems like it keeps 5-6 frame difference
between my calculated PTS and running time of the pipeline. Whole
pipeline have also 5 elements appsrc ! videoscale ! videoconvert !
videorate ! deckslinksink. I suspect that each element have single
buffer at time so it lead to five buffer latency which I observe.



More information about the gstreamer-devel mailing list