mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
matroskademux: Let upstream handle seeking/duration query in time if possible
So proper response are given for dash streams Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3159>
This commit is contained in:
parent
8c7579e129
commit
f7abd81a45
1 changed files with 23 additions and 14 deletions
|
@ -1841,10 +1841,15 @@ gst_matroska_demux_query (GstMatroskaDemux * demux, GstPad * pad,
|
||||||
|
|
||||||
res = TRUE;
|
res = TRUE;
|
||||||
if (format == GST_FORMAT_TIME) {
|
if (format == GST_FORMAT_TIME) {
|
||||||
GST_OBJECT_LOCK (demux);
|
res = gst_pad_query_default (pad, GST_OBJECT_CAST (demux), query);
|
||||||
gst_query_set_duration (query, GST_FORMAT_TIME,
|
if (!res) {
|
||||||
demux->common.segment.duration);
|
GST_OBJECT_LOCK (demux);
|
||||||
GST_OBJECT_UNLOCK (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
|
} else if (format == GST_FORMAT_DEFAULT && context
|
||||||
&& context->default_duration) {
|
&& context->default_duration) {
|
||||||
GST_OBJECT_LOCK (demux);
|
GST_OBJECT_LOCK (demux);
|
||||||
|
@ -1864,22 +1869,26 @@ gst_matroska_demux_query (GstMatroskaDemux * demux, GstPad * pad,
|
||||||
GstFormat fmt;
|
GstFormat fmt;
|
||||||
|
|
||||||
gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL);
|
gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL);
|
||||||
GST_OBJECT_LOCK (demux);
|
|
||||||
if (fmt == GST_FORMAT_TIME) {
|
if (fmt == GST_FORMAT_TIME) {
|
||||||
gboolean seekable;
|
gboolean seekable;
|
||||||
|
|
||||||
if (demux->streaming) {
|
res = gst_pad_query_default (pad, GST_OBJECT_CAST (demux), query);
|
||||||
/* assuming we'll be able to get an index ... */
|
if (!res) {
|
||||||
seekable = demux->seekable;
|
GST_OBJECT_LOCK (demux);
|
||||||
} else {
|
if (demux->streaming) {
|
||||||
seekable = TRUE;
|
/* assuming we'll be able to get an index ... */
|
||||||
}
|
seekable = demux->seekable;
|
||||||
|
} else {
|
||||||
|
seekable = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
gst_query_set_seeking (query, GST_FORMAT_TIME, seekable,
|
gst_query_set_seeking (query, GST_FORMAT_TIME, seekable,
|
||||||
0, demux->common.segment.duration);
|
0, demux->common.segment.duration);
|
||||||
|
GST_OBJECT_UNLOCK (demux);
|
||||||
|
}
|
||||||
res = TRUE;
|
res = TRUE;
|
||||||
}
|
}
|
||||||
GST_OBJECT_UNLOCK (demux);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GST_QUERY_SEGMENT:
|
case GST_QUERY_SEGMENT:
|
||||||
|
|
Loading…
Reference in a new issue