From 375d16a9fad1b2cab4aa74791eae3533099ce2dc Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Fri, 1 Mar 2024 02:44:57 +1100 Subject: [PATCH] rtspsrc: Parse Speed/Scale before Range in responses Parse the speed and scale in the server's response *before* the range, so that the range start/stop are swapped (or not swapped) correctly based on the server's actual chosen values. Otherwise, the old rate from the segment is used - what the last seek asked for, but not necessarily what the server chooses. Part-of: --- subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.c b/subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.c index 26d9c67b76..fec122ce45 100644 --- a/subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.c +++ b/subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.c @@ -9022,12 +9022,6 @@ restart: gst_rtsp_message_unset (&request); - /* parse RTP npt field. This is the current position in the stream (Normal - * Play Time) and should be put in the NEWSEGMENT position field. */ - if (gst_rtsp_message_get_header (&response, GST_RTSP_HDR_RANGE, &hval, - 0) == GST_RTSP_OK) - gst_rtspsrc_parse_range (src, hval, segment, FALSE); - /* assume 1.0 rate now, overwrite when the SCALE or SPEED headers are present. */ segment->rate = 1.0; @@ -9041,6 +9035,12 @@ restart: segment->rate = gst_rtspsrc_get_float (hval); } + /* parse RTP npt field. This is the current position in the stream (Normal + * Play Time) and should be put in the NEWSEGMENT position field. */ + if (gst_rtsp_message_get_header (&response, GST_RTSP_HDR_RANGE, &hval, + 0) == GST_RTSP_OK) + gst_rtspsrc_parse_range (src, hval, segment, FALSE); + /* parse the RTP-Info header field (if ANY) to get the base seqnum and timestamp * for the RTP packets. If this is not present, we assume all starts from 0... * This is info for the RTP session manager that we pass to it in caps. */