From 2401660d2f200007d00337a86dc4d88f51a2f3f8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Wed, 25 Aug 2010 13:42:17 +0000
Subject: [PATCH] rtsp: Return EOF if the TCP control channel is closed

Originally committed as revision 24920 to svn://svn.ffmpeg.org/ffmpeg/trunk
---
 libavformat/rtsp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 36fe7539157..c9563319beb 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -797,7 +797,7 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
             dprintf(s, "ret=%d c=%02x [%c]\n", ret, ch, ch);
 #endif
             if (ret != 1)
-                return -1;
+                return AVERROR_EOF;
             if (ch == '\n')
                 break;
             if (ch == '$') {
@@ -1719,8 +1719,8 @@ redo:
         RTSPMessageHeader reply;
 
         ret = ff_rtsp_read_reply(s, &reply, NULL, 1);
-        if (ret == -1)
-            return -1;
+        if (ret < 0)
+            return ret;
         if (ret == 1) /* received '$' */
             break;
         /* XXX: parse message */
-- 
GitLab