From f7abd81a456580a01c71eac14b15cb22e7bafc2a Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Thu, 22 Sep 2022 11:20:55 -0300 Subject: [PATCH] matroskademux: Let upstream handle seeking/duration query in time if possible So proper response are given for dash streams Part-of: --- .../gst-plugins-good/gst/matroska/matroska-demux.c | 37 ++++++++++++++-------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/subprojects/gst-plugins-good/gst/matroska/matroska-demux.c b/subprojects/gst-plugins-good/gst/matroska/matroska-demux.c index f380419..773a306 100644 --- a/subprojects/gst-plugins-good/gst/matroska/matroska-demux.c +++ b/subprojects/gst-plugins-good/gst/matroska/matroska-demux.c @@ -1841,10 +1841,15 @@ gst_matroska_demux_query (GstMatroskaDemux * demux, GstPad * pad, res = TRUE; if (format == GST_FORMAT_TIME) { - GST_OBJECT_LOCK (demux); - gst_query_set_duration (query, GST_FORMAT_TIME, - demux->common.segment.duration); - GST_OBJECT_UNLOCK (demux); + res = gst_pad_query_default (pad, GST_OBJECT_CAST (demux), query); + if (!res) { + GST_OBJECT_LOCK (demux); + gst_query_set_duration (query, GST_FORMAT_TIME, + demux->common.segment.duration); + GST_OBJECT_UNLOCK (demux); + + res = TRUE; + } } else if (format == GST_FORMAT_DEFAULT && context && context->default_duration) { GST_OBJECT_LOCK (demux); @@ -1864,22 +1869,26 @@ gst_matroska_demux_query (GstMatroskaDemux * demux, GstPad * pad, GstFormat fmt; gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL); - GST_OBJECT_LOCK (demux); if (fmt == GST_FORMAT_TIME) { gboolean seekable; - if (demux->streaming) { - /* assuming we'll be able to get an index ... */ - seekable = demux->seekable; - } else { - seekable = TRUE; - } + res = gst_pad_query_default (pad, GST_OBJECT_CAST (demux), query); + if (!res) { + GST_OBJECT_LOCK (demux); + if (demux->streaming) { + /* assuming we'll be able to get an index ... */ + seekable = demux->seekable; + } else { + seekable = TRUE; + } - gst_query_set_seeking (query, GST_FORMAT_TIME, seekable, - 0, demux->common.segment.duration); + gst_query_set_seeking (query, GST_FORMAT_TIME, seekable, + 0, demux->common.segment.duration); + GST_OBJECT_UNLOCK (demux); + } res = TRUE; } - GST_OBJECT_UNLOCK (demux); + break; } case GST_QUERY_SEGMENT: -- 2.7.4