From 959a9b494b7eb2d5ea02bae722339c75a93d7e1e Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Thu, 30 Apr 2009 10:24:27 +0200 Subject: rtspsrc: avoid errors after server eof Server eof (e.g. connection closed) is announced as connection closed, so better record state and act accordingly to prevent (read/write) errors during subsequent teardown/cleanup sequences. #Fixes 580851.(c). --- gst/rtsp/gstrtspsrc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'gst/rtsp') diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index b80ecead..3d572863 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -2964,6 +2964,7 @@ server_eof: GST_DEBUG_OBJECT (src, "we got an eof from the server"); GST_ELEMENT_WARNING (src, RESOURCE, READ, (NULL), ("The server closed the connection.")); + src->connected = FALSE; return GST_FLOW_UNEXPECTED; } interrupt: @@ -3209,6 +3210,7 @@ server_eof: GST_DEBUG_OBJECT (src, "we got an eof from the server"); GST_ELEMENT_WARNING (src, RESOURCE, READ, (NULL), ("The server closed the connection.")); + src->connected = FALSE; return GST_FLOW_UNEXPECTED; } } @@ -4717,7 +4719,12 @@ gst_rtspsrc_close (GstRTSPSrc * src) GST_DEBUG_OBJECT (src, "stop connection flush"); gst_rtsp_connection_flush (src->connection, FALSE); - if (src->methods & (GST_RTSP_PLAY | GST_RTSP_TEARDOWN) && src->connected) { + if (!src->connected) { + GST_DEBUG_OBJECT (src, "not connected, doing cleanup"); + goto close; + } + + if (src->methods & (GST_RTSP_PLAY | GST_RTSP_TEARDOWN)) { /* do TEARDOWN */ res = gst_rtsp_message_init_request (&request, GST_RTSP_TEARDOWN, -- cgit