mpegtsdemux: Fix off by one error
authorEdward Hervey <edward@centricular.com>
Fri, 13 Nov 2020 16:50:03 +0000 (17:50 +0100)
committerEdward Hervey <bilboed@bilboed.com>
Fri, 13 Nov 2020 16:50:03 +0000 (17:50 +0100)
Turns out timestamps of zero are valid :) Fixes issues with streams where the
PTS/DTS would be equal to the first PCR.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1807>

gst/mpegtsdemux/mpegtspacketizer.c

index a0ba2a5..fc6967a 100644 (file)
@@ -2268,7 +2268,7 @@ mpegts_packetizer_pts_to_ts (MpegTSPacketizer2 * packetizer,
       res = GST_CLOCK_TIME_NONE;
     else {
       GstClockTime tmp = pcrtable->base_time + pcrtable->skew;
-      if (tmp + res > pcrtable->base_pcrtime)
+      if (tmp + res >= pcrtable->base_pcrtime)
         res += tmp - pcrtable->base_pcrtime;
       else
         res = GST_CLOCK_TIME_NONE;