From ec2d6053a0a6e8cf1b6822c4f26be61b2ac699be Mon Sep 17 00:00:00 2001 From: Josep Torra Date: Sat, 18 Apr 2009 08:45:18 +0200 Subject: rtspsrc: map GST_RTSP_EEOF to EOS on server requests Permit properly handle the EOS condition when server report it in a request. --- gst/rtsp/gstrtspsrc.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'gst/rtsp') diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index 3cb2f9cc..f23ed542 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -2675,7 +2675,8 @@ gst_rtspsrc_handle_request (GstRTSPSrc * src, GstRTSPMessage * request) res = gst_rtspsrc_connection_send (src, &response, NULL); if (res < 0) goto send_error; - } + } else if (res == GST_RTSP_EEOF) + return res; return GST_RTSP_OK; @@ -2798,7 +2799,10 @@ gst_rtspsrc_loop_interleaved (GstRTSPSrc * src) switch (message.type) { case GST_RTSP_MESSAGE_REQUEST: /* server sends us a request message, handle it */ - if ((res = gst_rtspsrc_handle_request (src, &message)) < 0) + res = gst_rtspsrc_handle_request (src, &message); + if (res == GST_RTSP_EEOF) + goto server_eof; + else if (res < 0) goto handle_request_failed; break; case GST_RTSP_MESSAGE_RESPONSE: @@ -3056,7 +3060,10 @@ gst_rtspsrc_loop_udp (GstRTSPSrc * src) switch (message.type) { case GST_RTSP_MESSAGE_REQUEST: /* server sends us a request message, handle it */ - if ((res = gst_rtspsrc_handle_request (src, &message)) < 0) + res = gst_rtspsrc_handle_request (src, &message); + if (res == GST_RTSP_EEOF) + goto server_eof; + else if (res < 0) goto handle_request_failed; break; case GST_RTSP_MESSAGE_RESPONSE: @@ -3186,6 +3193,13 @@ play_failed: GST_DEBUG_OBJECT (src, "play failed"); return GST_FLOW_OK; } +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.")); + return GST_FLOW_UNEXPECTED; + } } static void @@ -3551,7 +3565,10 @@ next: switch (response->type) { case GST_RTSP_MESSAGE_REQUEST: - if ((res = gst_rtspsrc_handle_request (src, response)) < 0) + res = gst_rtspsrc_handle_request (src, response); + if (res == GST_RTSP_EEOF) + goto server_eof; + else if (res < 0) goto handle_request_failed; goto next; case GST_RTSP_MESSAGE_RESPONSE: @@ -3633,6 +3650,13 @@ handle_request_failed: /* ERROR was posted */ return res; } +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.")); + return GST_FLOW_UNEXPECTED; + } } /** -- cgit