Improve and fix LATENCY query handling
This now follows the design docs everywhere, especially the maximum latency
handling.
https://bugzilla.gnome.org/show_bug.cgi?id=744106
diff --git a/gst/interleave/interleave.c b/gst/interleave/interleave.c
index 2a2fd6e..1d36654 100644
--- a/gst/interleave/interleave.c
+++ b/gst/interleave/interleave.c
@@ -1079,15 +1079,17 @@
if (res) {
gst_query_parse_latency (peerquery, &live_cur, &min_cur, &max_cur);
- if (min_cur > min)
- min = min_cur;
+ if (live_cur) {
+ if (min_cur > min)
+ min = min_cur;
- if (max_cur != GST_CLOCK_TIME_NONE &&
- ((max != GST_CLOCK_TIME_NONE && max_cur > max) ||
- (max == GST_CLOCK_TIME_NONE)))
- max = max_cur;
+ if (max == GST_CLOCK_TIME_NONE)
+ max = max_cur;
+ else if (max_cur < max)
+ max = max_cur;
- live = live || live_cur;
+ live = TRUE;
+ }
}
gst_query_unref (peerquery);
diff --git a/gst/rtsp/gstrtpdec.c b/gst/rtsp/gstrtpdec.c
index b59aa5d..e24927b 100644
--- a/gst/rtsp/gstrtpdec.c
+++ b/gst/rtsp/gstrtpdec.c
@@ -372,6 +372,7 @@
case GST_QUERY_LATENCY:
{
/* we pretend to be live with a 3 second latency */
+ /* FIXME: Do we really have infinite maximum latency? */
gst_query_set_latency (query, TRUE, 3 * GST_SECOND, -1);
res = TRUE;
break;
diff --git a/gst/videomixer/videomixer2.c b/gst/videomixer/videomixer2.c
index abb18f8..e395645 100644
--- a/gst/videomixer/videomixer2.c
+++ b/gst/videomixer/videomixer2.c
@@ -1472,15 +1472,17 @@
if (res) {
gst_query_parse_latency (peerquery, &live_cur, &min_cur, &max_cur);
- if (min_cur > min)
- min = min_cur;
+ if (live_cur) {
+ if (min_cur > min)
+ min = min_cur;
- if (max_cur != GST_CLOCK_TIME_NONE &&
- ((max != GST_CLOCK_TIME_NONE && max_cur > max) ||
- (max == GST_CLOCK_TIME_NONE)))
- max = max_cur;
+ if (max == GST_CLOCK_TIME_NONE)
+ max = max_cur;
+ else if (max_cur < max)
+ max = max_cur;
- live = live || live_cur;
+ live = TRUE;
+ }
}
gst_query_unref (peerquery);