From d870dcd0a35125f7e3fc944e5b1911e768880f13 Mon Sep 17 00:00:00 2001 From: Jeffy Chen Date: Tue, 24 May 2022 12:40:03 +0800 Subject: [PATCH 09/12] 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 --- 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 9b3cf83..77155a3 100644 --- a/gst/matroska/matroska-demux.c +++ b/gst/matroska/matroska-demux.c @@ -4770,6 +4770,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 3fcb5c5..ff22ec2 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 0149b17..8c2e126 100644 --- a/gst/matroska/matroska-read-common.c +++ b/gst/matroska/matroska-read-common.c @@ -3420,6 +3420,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 98cfc24..40ea641 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