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:
Tim-Philipp Müller 2011-05-03 12:01:25 +01:00
parent 0d9dbd4c0f
commit 7ec71fb446

View file

@ -406,12 +406,16 @@ gst_hls_demux_src_query (GstPad * pad, GstQuery * query)
switch (query->type) {
case GST_QUERY_DURATION:{
GstClockTime duration;
GstFormat fmt;
gst_query_parse_duration (query, &fmt, NULL);
if (fmt == GST_FORMAT_TIME) {
duration = gst_m3u8_client_get_duration (hlsdemux->client);
if (duration) {
if (GST_CLOCK_TIME_IS_VALID (duration) && duration > 0) {
gst_query_set_duration (query, GST_FORMAT_TIME, duration);
ret = TRUE;
}
}
break;
}
case GST_QUERY_URI: