How to handle negative dvb pcr changes in gstreamer

Sebastian Dröge sebastian at centricular.com
Mon Jan 18 05:58:35 PST 2016


On Mo, 2016-01-18 at 01:10 -0800, abdus_salam wrote:
> Hi,
> 
> First of all, I asked the same question on stackoverflow a few days ago and
> as there is no response yet, I decided to post it over here. To avoid any
> confusion, here is the link for the original question
> http://stackoverflow.com/questions/34786975/how-to-handle-negative-dvb-pcr-changes-in-gstreamer
> 
> On our gstreamer pipeline which plays DVB streams, we are calibrating the
> system clock with PCR values from the stream. However, when the stream wraps
> (looping a recorded stream use case) or a broadcaster decides to change the
> PCR base to a value smaller than the current one (allowed in the spec), I am
> not quite sure how this should be handled because, due to its monotonic
> nature, clock freezes until it catches up with the last value.
> 
> One workaround I can think of is, first calibrating the clock to max clock
> value, then let the clock overflow and recalibrate it with the new PCR. Is
> this a valid thing to do? I presume the pipeline elements are designed to
> cope with clock wraps.

You can detect the wraparound by checking for a high enough
discontinuity of PCR. If the change between previous and following PCR
is bigger than half the PCR range, you found a wraparound.

This is implemented in GStreamer's tsdemux since a while (you mentioned
GStreamer 0.10, it probably was not implemented there yet) but of
course there might be some bugs. Can you test if it works for you with
tsdemux from 1.6, and if not file a bug with a debug log? The debug log
should be with GST_DEBUG=3,*ts*:6

-- 
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160118/94f242f2/attachment.sig>


More information about the gstreamer-devel mailing list