[FFmpeg-devel] [PATCH] avformat/unix: handling EOF in case of SOCK_STREAM
Bodecs Bela
bodecsb at vivanet.hu
Wed Mar 21 00:28:56 EET 2018
Dear All,
when recv() returns 0 in case of SOCK_STREAM type, it means EOF and with
this patch returns value accordingly.
See the original thread "[PATCH] avformat/unix: properly handling
timeout at reading" for details.
please review this patch!
thank you in advance!
best regards,
Bela Bodecs
-------------- next part --------------
>From 3a022da0ebd01b65fd3beed95a13ea0f0fcabb20 Mon Sep 17 00:00:00 2001
From: Bela Bodecs <bodecsb at vivanet.hu>
Date: Tue, 20 Mar 2018 23:24:11 +0100
Subject: [PATCH] avformat/unix: handling EOF in case of SOCK_STREAM
when recv() returns 0 in case of SOCK_STREAM type, it means EOF and with
this patch returns value accordingly.
Signed-off-by: Bela Bodecs <bodecsb at vivanet.hu>
---
libavformat/unix.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libavformat/unix.c b/libavformat/unix.c
index 4f01d14..38016db 100644
--- a/libavformat/unix.c
+++ b/libavformat/unix.c
@@ -111,6 +111,8 @@ static int unix_read(URLContext *h, uint8_t *buf, int size)
return ret;
}
ret = recv(s->fd, buf, size, 0);
+ if (!ret && s->type == SOCK_STREAM)
+ return AVERROR_EOF;
return ret < 0 ? ff_neterrno() : ret;
}
--
2.5.3.windows.1
More information about the ffmpeg-devel
mailing list