new/buildroot/package/gstreamer1/gst1-plugins-good/0009-matroska-demux-parse-Disable-QoS-lace-skipping-by-de.patch
2025-05-10 21:58:58 +08:00

74 lines
2.9 KiB
Diff

From 7706971089dbae3a24b3073ecf2b7a225715d6a6 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 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 <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 1e771b0..721db0d 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 6fadbba..eff8812 100644
--- a/gst/matroska/matroska-read-common.c
+++ b/gst/matroska/matroska-read-common.c
@@ -3417,6 +3417,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