mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 23:06:49 +00:00
hlsdemux: fix DURATION query handling
Only answer duration queries in TIME format with a duration in seconds. Make sure we don't return GST_CLOCK_TIME_NONE as duration (which is non-0, but still invalid/useless).
This commit is contained in:
parent
0d9dbd4c0f
commit
7ec71fb446
1 changed files with 8 additions and 4 deletions
|
@ -406,11 +406,15 @@ gst_hls_demux_src_query (GstPad * pad, GstQuery * query)
|
||||||
switch (query->type) {
|
switch (query->type) {
|
||||||
case GST_QUERY_DURATION:{
|
case GST_QUERY_DURATION:{
|
||||||
GstClockTime duration;
|
GstClockTime duration;
|
||||||
|
GstFormat fmt;
|
||||||
|
|
||||||
duration = gst_m3u8_client_get_duration (hlsdemux->client);
|
gst_query_parse_duration (query, &fmt, NULL);
|
||||||
if (duration) {
|
if (fmt == GST_FORMAT_TIME) {
|
||||||
gst_query_set_duration (query, GST_FORMAT_TIME, duration);
|
duration = gst_m3u8_client_get_duration (hlsdemux->client);
|
||||||
ret = TRUE;
|
if (GST_CLOCK_TIME_IS_VALID (duration) && duration > 0) {
|
||||||
|
gst_query_set_duration (query, GST_FORMAT_TIME, duration);
|
||||||
|
ret = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue