[FFmpeg-devel] [PATCH] lavf/tcp: return EOF on read, but not 0

Takayuki 'January June' Suwa jjsuwa.sys3175 at gmail.com
Sat Oct 21 06:24:40 EEST 2017


related to commit '858db4b01fa2b55ee55056c033054ca54ac9b0fd'.

---
 libavformat/tcp.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index 07b4ed9..5438122 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -220,7 +220,12 @@ static int tcp_read(URLContext *h, uint8_t *buf, int size)
             return ret;
     }
     ret = recv(s->fd, buf, size, 0);
-    return ret < 0 ? ff_neterrno() : ret;
+    if (ret < 0)
+        return ff_neterrno();
+    else if (ret == 0)
+        return AVERROR_EOF;
+    else
+        return ret;
 }
 
 static int tcp_write(URLContext *h, const uint8_t *buf, int size)
-- 
2.1.4



More information about the ffmpeg-devel mailing list