hc
2023-05-26 a23f51ed7a39e452c1037343a84d7db1ca2c5bd7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
From 2b188223abebbc0020a3683d891b98d3f8528541 Mon Sep 17 00:00:00 2001
From: Jeffy Chen <jeffy.chen@rock-chips.com>
Date: Tue, 24 May 2022 12:40:03 +0800
Subject: [PATCH 9/9] matroska-{demux,parse}: Disable QoS lace skipping by
 default
 
The QoS's timestamp would not reset in some cases, using it to skip late
laces rather dangerous.
 
Tested with:
gst-play-1.0 --gapless 1.webm 1.webm
 
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---
 gst/matroska/matroska-demux.c       | 1 +
 gst/matroska/matroska-parse.c       | 1 +
 gst/matroska/matroska-read-common.c | 2 ++
 gst/matroska/matroska-read-common.h | 2 ++
 4 files changed, 6 insertions(+)
 
diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c
index 52a76b9d9..ceabeddcc 100644
--- a/gst/matroska/matroska-demux.c
+++ b/gst/matroska/matroska-demux.c
@@ -4744,6 +4744,7 @@ gst_matroska_demux_parse_blockgroup_or_simpleblock (GstMatroskaDemux * demux,
          index entries point to keyframes, but if that is not true we
          will instead skip until the next keyframe. */
       if (GST_CLOCK_TIME_IS_VALID (lace_time) &&
+          demux->common.allow_skipping &&
           stream->type == GST_MATROSKA_TRACK_TYPE_VIDEO &&
           stream->index_table && demux->common.segment.rate > 0.0) {
         GstMatroskaTrackVideoContext *videocontext =
diff --git a/gst/matroska/matroska-parse.c b/gst/matroska/matroska-parse.c
index 3fcb5c55e..ff22ec228 100644
--- a/gst/matroska/matroska-parse.c
+++ b/gst/matroska/matroska-parse.c
@@ -1878,6 +1878,7 @@ gst_matroska_parse_parse_blockgroup_or_simpleblock (GstMatroskaParse * parse,
          index entries point to keyframes, but if that is not true we
          will instead skip until the next keyframe. */
       if (GST_CLOCK_TIME_IS_VALID (lace_time) &&
+          parse->common.allow_skipping &&
           stream->type == GST_MATROSKA_TRACK_TYPE_VIDEO &&
           stream->index_table && parse->common.segment.rate > 0.0) {
         GstMatroskaTrackVideoContext *videocontext =
diff --git a/gst/matroska/matroska-read-common.c b/gst/matroska/matroska-read-common.c
index eb317644c..334872a52 100644
--- a/gst/matroska/matroska-read-common.c
+++ b/gst/matroska/matroska-read-common.c
@@ -3371,6 +3371,8 @@ gst_matroska_read_common_reset (GstElement * element,
     ctx->internal_toc = NULL;
   }
   ctx->toc_updated = FALSE;
+
+  ctx->allow_skipping = !!g_getenv ("GST_MATROSKA_ALLOW_SKIP");
 }
 
 /* call with object lock held */
diff --git a/gst/matroska/matroska-read-common.h b/gst/matroska/matroska-read-common.h
index 98cfc2451..40ea64199 100644
--- a/gst/matroska/matroska-read-common.h
+++ b/gst/matroska/matroska-read-common.h
@@ -115,6 +115,8 @@ typedef struct _GstMatroskaReadCommon {
   /* cache for track tags that forward-reference their tracks */
   GHashTable *cached_track_taglists ;
 
+  /* allow QoS lace skipping */
+  gboolean allow_skipping;
 } GstMatroskaReadCommon;
 
 GstFlowReturn gst_matroska_decode_content_encodings (GArray * encodings);
-- 
2.20.1