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