summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Saunier <tsaunier@igalia.com>2020-04-08 09:45:17 -0400
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2020-09-27 12:48:39 +0000
commit2d52e4ac1d32caf6fa2d4080601b1736ef146ec8 (patch)
tree0e4b223ff045fb9cb929b22b7e739c7441e11bd7
parent43ccc517a323609e685abbd78d96dfc16ae895b5 (diff)
downloadgstreamer-plugins-good-2d52e4ac1d32caf6fa2d4080601b1736ef146ec8.tar.gz
rtspsrc: Avoid stack overflow recursing waiting for response
Instead of recursing, simply implement a loop with gotos, the same way it was done before 812175288769d647ed6388755aed386378d9210c Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/710 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/751>
-rw-r--r--gst/rtsp/gstrtspsrc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c
index 583168dab..de46fcdd2 100644
--- a/gst/rtsp/gstrtspsrc.c
+++ b/gst/rtsp/gstrtspsrc.c
@@ -6246,8 +6246,11 @@ gst_rtsp_src_receive_response (GstRTSPSrc * src, GstRTSPConnInfo * conninfo,
{
GstRTSPStatusCode thecode;
gchar *content_base = NULL;
- GstRTSPResult res = gst_rtspsrc_connection_receive (src, conninfo,
- response, src->ptcp_timeout);
+ GstRTSPResult res;
+
+next:
+ res = gst_rtspsrc_connection_receive (src, conninfo, response,
+ src->ptcp_timeout);
if (res < 0)
goto receive_error;
@@ -6263,7 +6266,7 @@ gst_rtsp_src_receive_response (GstRTSPSrc * src, GstRTSPConnInfo * conninfo,
goto handle_request_failed;
/* Not a response, receive next message */
- return gst_rtsp_src_receive_response (src, conninfo, response, code);
+ goto next;
case GST_RTSP_MESSAGE_RESPONSE:
/* ok, a response is good */
GST_DEBUG_OBJECT (src, "received response message");
@@ -6274,13 +6277,13 @@ gst_rtsp_src_receive_response (GstRTSPSrc * src, GstRTSPConnInfo * conninfo,
gst_rtspsrc_handle_data (src, response);
/* Not a response, receive next message */
- return gst_rtsp_src_receive_response (src, conninfo, response, code);
+ goto next;
default:
GST_WARNING_OBJECT (src, "ignoring unknown message type %d",
response->type);
/* Not a response, receive next message */
- return gst_rtsp_src_receive_response (src, conninfo, response, code);
+ goto next;
}
thecode = response->type_data.response.code;