tsdemux: check pcr_pid when calculating stream time 18/288418/3
authorGilbok Lee <gilbok.lee@samsung.com>
Thu, 16 Feb 2023 08:43:32 +0000 (17:43 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Fri, 17 Feb 2023 08:01:02 +0000 (17:01 +0900)
- if the pcr_pid is 0x1fff, the pcr value is ignored
  and last_pcrtime is also invalid value.

Change-Id: I257dfe547a71d4092cade2743c37752a7a48828a

packaging/gstreamer.spec
subprojects/gst-plugins-bad/gst/mpegtsdemux/mpegtspacketizer.c

index 230285c..5a590fd 100644 (file)
@@ -62,7 +62,7 @@
 
 Name:           %{_name}
 Version:        1.22.0
-Release:        14
+Release:        15
 Summary:        Streaming-Media Framework Runtime
 License:        LGPL-2.0+
 Group:          Multimedia/Framework
index bae2d29..8d2e442 100644 (file)
@@ -2310,13 +2310,19 @@ mpegts_packetizer_pts_to_ts_internal (MpegTSPacketizer2 * packetizer,
       else
         res = GST_CLOCK_TIME_NONE;
     } else {
-      if (G_UNLIKELY (ABSDIFF (res, pcrtable->last_pcrtime) > 15 * GST_SECOND))
+      if (G_UNLIKELY (check_diff && pcr_pid != 0x1fff &&
+            ABSDIFF (res, pcrtable->last_pcrtime) > 15 * GST_SECOND)) {
         GST_WARNING
             ("VOD Stream : Server sending erronous PCR values : Maintaining old ts value !!!");
-      else if (tmp + res > pcrtable->base_pcrtime)
+      } else if (tmp + res > pcrtable->base_pcrtime) {
         res += tmp - pcrtable->base_pcrtime;
-      else
+      } else if (!check_diff || ABSDIFF (tmp + res + PCR_GST_MAX_VALUE,
+              pcrtable->base_pcrtime) < PCR_GST_MAX_VALUE / 2) {
+        /* Handle wrapover */
+        res += tmp + PCR_GST_MAX_VALUE - pcrtable->base_pcrtime;
+      } else {
         res = GST_CLOCK_TIME_NONE;
+      }
     }
 #else
     if (G_UNLIKELY (check_diff && pcr_pid != 0x1fff &&