diff options
author | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2011-05-03 12:01:25 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2011-05-03 12:01:25 +0100 |
commit | 7ec71fb446eaf1f6e7c5fa29909fc23d96ab86e8 (patch) | |
tree | 783ab582c9ad7afb648b76050940c061fac4a8e3 /gst/hls | |
parent | 0d9dbd4c0f1a50240fa1459df68ea7efc8dd26d3 (diff) |
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).
Diffstat (limited to 'gst/hls')
-rw-r--r-- | gst/hls/gsthlsdemux.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gst/hls/gsthlsdemux.c b/gst/hls/gsthlsdemux.c index c5644914d..90eaf745f 100644 --- a/gst/hls/gsthlsdemux.c +++ b/gst/hls/gsthlsdemux.c @@ -406,11 +406,15 @@ gst_hls_demux_src_query (GstPad * pad, GstQuery * query) switch (query->type) { case GST_QUERY_DURATION:{ GstClockTime duration; + GstFormat fmt; - duration = gst_m3u8_client_get_duration (hlsdemux->client); - if (duration) { - gst_query_set_duration (query, GST_FORMAT_TIME, duration); - ret = TRUE; + gst_query_parse_duration (query, &fmt, NULL); + if (fmt == GST_FORMAT_TIME) { + duration = gst_m3u8_client_get_duration (hlsdemux->client); + if (GST_CLOCK_TIME_IS_VALID (duration) && duration > 0) { + gst_query_set_duration (query, GST_FORMAT_TIME, duration); + ret = TRUE; + } } break; } |