mpegtspacketizer: Changes to run upstream code if the ignore-pcr property is set 69/306369/2
authorGilbok Lee <gilbok.lee@samsung.com>
Wed, 21 Feb 2024 00:47:54 +0000 (09:47 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Mon, 4 Mar 2024 07:41:42 +0000 (16:41 +0900)
Change-Id: Ida2ca4dc55dcd204971701c82e2cdbec58086ab1

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

index b2a87a81391c136b4555dd24f355ef4c89fb5eee..7c99464e4147a4ef133a0f732375db24a57fd5ab 100644 (file)
@@ -62,7 +62,7 @@
 
 Name:           %{_name}
 Version:        1.20.0
-Release:        53
+Release:        54
 Summary:        Streaming-Media Framework Runtime
 License:        LGPL-2.0+
 Group:          Multimedia/Framework
index 47995af1c706103b0d802b06e67f8e95bb1d0f0d..b57b47550e5c7d1e7d74cf29d44bb801b9f89df9 100644 (file)
@@ -2303,23 +2303,37 @@ mpegts_packetizer_pts_to_ts (MpegTSPacketizer2 * packetizer,
      */
 #ifdef TIZEN_FEATURE_TSDEMUX_MODIFICATION
     tmp = pcrtable->base_time + pcrtable->skew;
-    if (packetizer->is_live_stream) {
-      if (G_UNLIKELY (ABSDIFF (res, pcrtable->last_pcrtime) > 15 * GST_SECOND))
-        GST_WARNING
-            ("Live Stream : Server sending erronous PCR values : Recalculating!!");
-
-      if (tmp + res > pcrtable->base_pcrtime)
+    if (G_UNLIKELY ((pcr_pid == 0x1fff) ||
+          ABSDIFF (res, pcrtable->last_pcrtime) <= 15 * GST_SECOND)) {
+      if (tmp + res >= pcrtable->base_pcrtime) {
         res += tmp - pcrtable->base_pcrtime;
-      else
+      } else if (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 {
+        /* Fallback for values that differ way too much */
         res = GST_CLOCK_TIME_NONE;
+      }
     } else {
-      if (G_UNLIKELY (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)
-        res += tmp - pcrtable->base_pcrtime;
-      else
-        res = GST_CLOCK_TIME_NONE;
+      if (packetizer->is_live_stream) {
+        if (G_UNLIKELY (ABSDIFF (res, pcrtable->last_pcrtime) > 15 * GST_SECOND))
+          GST_WARNING
+              ("Live Stream : Server sending erroneous PCR values : Recalculating!!");
+
+        if (tmp + res > pcrtable->base_pcrtime)
+          res += tmp - pcrtable->base_pcrtime;
+        else
+          res = GST_CLOCK_TIME_NONE;
+      } else {
+        if (G_UNLIKELY (ABSDIFF (res, pcrtable->last_pcrtime) > 15 * GST_SECOND))
+          GST_WARNING
+              ("VOD Stream : Server sending erroneous PCR values : Maintaining old ts value !!!");
+        else if (tmp + res > pcrtable->base_pcrtime)
+          res += tmp - pcrtable->base_pcrtime;
+        else
+          res = GST_CLOCK_TIME_NONE;
+      }
     }
 #else
     if (G_UNLIKELY (pcr_pid != 0x1fff &&