[FFmpeg-cvslog] tcp: properly return EOF
wm4
git at videolan.org
Sun Dec 31 17:18:40 EET 2017
ffmpeg | branch: master | wm4 <nfxjfg at googlemail.com> | Sat Dec 30 17:44:03 2017 +0100| [0e1f771d2200d14d298df09c91e14f51e418fd3a] | committer: wm4
tcp: properly return EOF
There is no POSIX error code for EOF - recv() signals EOF by simply
returning 0. But libavformat recently changed its conventions and
requires an explicit AVERROR_EOF, or it might get into an endless retry
loop, consuming 100% CPU while doing nothing.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0e1f771d2200d14d298df09c91e14f51e418fd3a
---
libavformat/tcp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index fef0729da6..8773493df1 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -225,6 +225,8 @@ static int tcp_read(URLContext *h, uint8_t *buf, int size)
return ret;
}
ret = recv(s->fd, buf, size, 0);
+ if (ret == 0)
+ return AVERROR_EOF;
return ret < 0 ? ff_neterrno() : ret;
}
More information about the ffmpeg-cvslog
mailing list