rtspsrc: Do not wait for response while flushing

Due to the may_cancel flag in GstRTSPConnection, receiving might not get
cancelled when supposed to. In this case, gst_rtsp_src_receive_response
will have to wait until timeout instead but if busy receiving RTP
data, this timeout will never occur.

With this patch, gst_rtsp_src_receive_response returns GST_RTSP_EINTR
if flushing is set to TRUE instead of continuing to receive.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/831>
This commit is contained in:
Tobias Ronge 2020-12-07 10:01:53 +01:00 committed by GStreamer Merge Bot
parent c854e6bd39
commit 706d91371c

View file

@ -5596,11 +5596,15 @@ gst_rtspsrc_loop_interleaved (GstRTSPSrc * src)
while (TRUE) {
gst_rtsp_message_unset (&message);
if (src->conninfo.flushing) {
/* do not attempt to receive if flushing */
res = GST_RTSP_EINTR;
} else {
/* protect the connection with the connection lock so that we can see when
* we are finished doing server communication */
res =
gst_rtspsrc_connection_receive (src, &src->conninfo,
&message, src->tcp_timeout);
res = gst_rtspsrc_connection_receive (src, &src->conninfo, &message,
src->tcp_timeout);
}
switch (res) {
case GST_RTSP_OK:
@ -5715,8 +5719,13 @@ gst_rtspsrc_loop_udp (GstRTSPSrc * src)
/* we should continue reading the TCP socket because the server might
* send us requests. When the session timeout expires, we need to send a
* keep-alive request to keep the session open. */
if (src->conninfo.flushing) {
/* do not attempt to receive if flushing */
res = GST_RTSP_EINTR;
} else {
res = gst_rtspsrc_connection_receive (src, &src->conninfo, &message,
timeout);
}
switch (res) {
case GST_RTSP_OK:
@ -6363,8 +6372,13 @@ gst_rtsp_src_receive_response (GstRTSPSrc * src, GstRTSPConnInfo * conninfo,
GstRTSPResult res;
next:
if (conninfo->flushing) {
/* do not attempt to receive if flushing */
res = GST_RTSP_EINTR;
} else {
res = gst_rtspsrc_connection_receive (src, conninfo, response,
src->tcp_timeout);
}
if (res < 0)
goto receive_error;