hlsdemux: Reset m3u8 sequence when fail three times to get next fragment 94/268994/5 accepted/tizen_unified tizen accepted/tizen/unified/20220118.123235 submit/tizen/20220112.051906 submit/tizen/20220117.073050
authorGilbok Lee <gilbok.lee@samsung.com>
Thu, 6 Jan 2022 05:21:25 +0000 (14:21 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Thu, 6 Jan 2022 23:13:33 +0000 (08:13 +0900)
- When media sequence of m3u8 decreases on live stream, fail to get next fragment

Change-Id: Iaae7ba7cf3439fcca5155e9cc7f3a1a95e85909e

ext/hls/gsthlsdemux.c
ext/hls/gsthlsdemux.h
packaging/gst-plugins-bad.spec

index cfbb68a..e41d3fd 100644 (file)
@@ -77,6 +77,10 @@ enum
 #define ABSDIFF(a,b) ((a) < (b) ? (b) - (a) : (a) - (b))
 #endif
 
+#ifdef TIZEN_FEATURE_HLSDEMUX_DISCONT_SEQUENCE
+#define DEFAULT_FAILED_COUNT 3
+#endif
+
 /* GObject */
 static void gst_hls_demux_finalize (GObject * obj);
 #ifdef TIZEN_FEATURE_HLSDEMUX_PROPERTY
@@ -701,6 +705,9 @@ create_stream_for_playlist (GstAdaptiveDemux * demux, GstM3U8 * playlist,
 
   hlsdemux_stream->do_typefind = TRUE;
   hlsdemux_stream->reset_pts = TRUE;
+#ifdef TIZEN_FEATURE_HLSDEMUX_DISCONT_SEQUENCE
+  hlsdemux_stream->failed_count = 0;
+#endif
 #ifdef TIZEN_FEATURE_HLSDEMUX_DISCONT
   hlsdemux_stream->sequence_pos = GST_CLOCK_TIME_NONE;
   hlsdemux_stream->last_pcr = GST_CLOCK_TIME_NONE;
@@ -1585,8 +1592,19 @@ gst_hls_demux_update_fragment_info (GstAdaptiveDemuxStream * stream)
 
   if (file == NULL) {
     GST_INFO_OBJECT (hlsdemux, "This playlist doesn't contain more fragments");
+#ifdef TIZEN_FEATURE_HLSDEMUX_DISCONT_SEQUENCE
+    if (++hlsdemux_stream->failed_count > DEFAULT_FAILED_COUNT) {
+      GST_WARNING_OBJECT (hlsdemux,
+          "Reset media sequence(fail %d times to gst_m3u8_get_next_fragment)",
+          hlsdemux_stream->failed_count);
+      m3u8->sequence = 0;
+    }
+#endif
     return GST_FLOW_EOS;
   }
+#ifdef TIZEN_FEATURE_HLSDEMUX_DISCONT_SEQUENCE
+  hlsdemux_stream->failed_count = 0;
+#endif
 
   if (stream->discont)
     discont = TRUE;
index 105afb3..18a3a2b 100644 (file)
@@ -126,7 +126,9 @@ struct _GstHLSDemuxStream
    * the stream so we can set timestamps/segments
    * and switch cleanly */
   GstBuffer *pending_pcr_buffer;
-
+#ifdef TIZEN_FEATURE_HLSDEMUX_DISCONT_SEQUENCE
+  gint failed_count;
+#endif
   GstHLSTSReader tsreader;
 };
 
index 32def80..c583762 100644 (file)
@@ -4,7 +4,7 @@
 
 Name:           gst-plugins-bad
 Version:        1.16.2
-Release:        28
+Release:        29
 Summary:        GStreamer Streaming-Media Framework Plug-Ins
 License:        LGPL-2.0+
 Group:          Multimedia/Framework
@@ -83,6 +83,7 @@ export CFLAGS+=" -Wall -g -fPIC\
   -DTIZEN_FEATURE_HLSDEMUX_PROPERTY\
   -DTIZEN_FEATURE_HLSDEMUX_EMPTY_VTT\
   -DTIZEN_FEATURE_HLSDEMUX_UPDATE_SEGMENT\
+  -DTIZEN_FEATURE_HLSDEMUX_DISCONT_SEQUENCE\
   -DTIZEN_FEATURE_TSDEMUX_MODIFICATION\
   -DTIZEN_FEATURE_TSDEMUX_INVALID_PCR_PID\
   -DTIZEN_FEATURE_TSDEMUX_LANG_TAG\