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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6248>
This commit is contained in:
Jan Schmidt 2024-03-01 02:44:57 +11:00 committed by GStreamer Marge Bot
parent 57013e1a7c
commit f53dbb28b2

View file

@ -9100,12 +9100,6 @@ restart:
gst_rtsp_message_unset (&request); 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. */ /* assume 1.0 rate now, overwrite when the SCALE or SPEED headers are present. */
segment->rate = 1.0; segment->rate = 1.0;
@ -9119,6 +9113,12 @@ restart:
segment->rate = gst_rtspsrc_get_float (hval); 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 /* 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... * 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. */ * This is info for the RTP session manager that we pass to it in caps. */