summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAurélien Zanelli <aurelien.zanelli@parrot.com>2015-01-20 16:20:10 +0100
committerJan Schmidt <jan@centricular.com>2016-03-03 00:50:15 +1100
commitd87177b69b15e049d8e7da13c590b0db2e51529b (patch)
treea5d24c4c67ce20e5bd9eb682274aca63ce2e88c2
parentc22a8a6224791bba7c73e9426545d6d897ea370c (diff)
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
-rw-r--r--gst/mpegtsdemux/mpegtspacketizer.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gst/mpegtsdemux/mpegtspacketizer.c b/gst/mpegtsdemux/mpegtspacketizer.c
index 3e348a64c..db3b7417d 100644
--- a/gst/mpegtsdemux/mpegtspacketizer.c
+++ b/gst/mpegtsdemux/mpegtspacketizer.c
@@ -2283,8 +2283,12 @@ mpegts_packetizer_pts_to_ts (MpegTSPacketizer2 * packetizer,
GST_DEBUG ("Using group !");
refpcr = group->first_pcr;
refpcroffset = group->pcr_offset;
- if (pts < refpcr)
- refpcr -= PCR_MAX_VALUE;
+ if (pts < PCRTIME_TO_GSTTIME (refpcr)) {
+ if (PCRTIME_TO_GSTTIME (refpcr) - pts > GST_SECOND)
+ pts += PCR_GST_MAX_VALUE;
+ else
+ refpcr = G_MAXINT64;
+ }
}
}
if (refpcr != G_MAXINT64)