From 1471100f37b6cf2382baaecb9d79f86260006829 Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Tue, 11 Feb 2020 21:52:41 +0100 Subject: [PATCH] rtspsrc: fix requested range When the server replies with a range "now-", it is presumed to be a "live" stream and we should request a similar range. This was the case prior to my refactoring to make use of gst_rtsp_range_to_string in 5f1a732bc7b76a6f1b8aa5f26b6e76fbca0261c7, this commit restores the behaviour for that case. --- gst/rtsp/gstrtspsrc.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index a61d299357..a0c58c926d 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -8378,10 +8378,20 @@ gen_range_header (GstRTSPSrc * src, GstSegment * segment) g_date_time_unref (prime_epoch); } else { range.unit = GST_RTSP_RANGE_NPT; - range.min.type = GST_RTSP_TIME_SECONDS; - range.min.seconds = begin_seconds; - range.max.type = GST_RTSP_TIME_SECONDS; - range.max.seconds = end_seconds; + + if (src->range && src->range->min.type == GST_RTSP_TIME_NOW) { + range.min.type = GST_RTSP_TIME_NOW; + } else { + range.min.type = GST_RTSP_TIME_SECONDS; + range.min.seconds = begin_seconds; + } + + if (src->range && src->range->max.type == GST_RTSP_TIME_END) { + range.max.type = GST_RTSP_TIME_END; + } else { + range.max.type = GST_RTSP_TIME_SECONDS; + range.max.seconds = end_seconds; + } } /* Don't set end bounds when not required to */