GNOME Bugzilla – Bug 743259
tsdemux: bogus timestamp when PTS < PCR
Last modified: 2016-04-14 17:43:03 UTC
Playing http://darkosphere.fr/tmp/payload.ts with the following pipeline doesn't work successfully: gst-launch-1.0 filesrc location=payload.ts ! tsdemux ! h264parse ! avdec_h264 ! autovideosink After further investigation, it is due to tsdemux outputting the first buffers with bogus timestamps which confuse videodecoder base class: /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = chain ******* (fakesink0:sink) (18233 bytes, dts: none, pts: 5124095:34:33.663077135, duration: none, offset: -1, offset_end: -1, flags: 00000040 discont ) 0xa0e5ae0 New clock: GstSystemClock /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = chain ******* (fakesink0:sink) (2031 bytes, dts: none, pts: 5124095:34:33.696410468, duration: none, offset: -1, offset_end: -1, flags: 00000000 ) 0xa0e5c20 This bogus timestamp are computed in mpegts_packetizer_pts_to_ts (mpegtspacketizer.c) and are wrong because PTS < PCRTIME_TO_GSTTIME(refpcr). I found that this issue is likely the same as the one fixed by commit a822517ca94c132104faf484d11aaeaaecf9769a (https://bugzilla.gnome.org/show_bug.cgi?id=731088) so I wrote likely the same patch for this part of the code.
Created attachment 295028 [details] [review] mpegtspacketizer: convert pcr time to gst time before comparing it to pts This little patch is to fix pts comparison with refpcr, i first found it when investigating this issue.
Created attachment 295029 [details] [review] mpegtspacketizer: handle early PTS conversion when a group has been found Proposal to fix the issue :)
I just encountered this exact issue and generated the same combined 2 patches.
Thanks, pushed as one squashed commit: commit d87177b69b15e049d8e7da13c590b0db2e51529b Author: Aurélien Zanelli <aurelien.zanelli@parrot.com> Date: Tue Jan 20 16:20:10 2015 +0100 mpegtspacketizer: handle early PTS conversion when a group has been found In some cases, the PTS might be smaller than the first observed PCR value which causes element to apply wraparound leading to bogus timestamp. To solve this, we only apply it if the PTS-PCR difference is greater that 1 second to be sure that it's a real wraparound. Moreover, using unsigned 32 bits values to handle wrapover could end up with bogus value, so it use pts value to handle it. Also, convert pcr time to gst time before comparing it to pts. Since refpcr is expressed in PCR time base while pts is expressed in GStreamer time. https://bugzilla.gnome.org/show_bug.cgi?id=743259
Comment on attachment 295029 [details] [review] mpegtspacketizer: handle early PTS conversion when a group has been found Combined.
Comment on attachment 295028 [details] [review] mpegtspacketizer: convert pcr time to gst time before comparing it to pts Combined.
Created attachment 322936 [details] [review] collectpads: Assume PTS is equal DTS if PTS is missing This is the best guess we can make if such a buffer reached the collect pad. This is uncommon, we do expect parsers to have tried and fixed that if possible (or needed).
Comment on attachment 322936 [details] [review] collectpads: Assume PTS is equal DTS if PTS is missing Sorry, wrong bug number.