[FFmpeg-devel] fix ftp hang up because not return AVRRROR_EOF

Gj X xiong2634528861 at gmail.com
Wed Jun 13 13:27:32 EEST 2018


fix:
diff --git a/libavformat/ftp.c b/libavformat/ftp.c
index 9aa7a45629..3474a0adbc 100644
--- a/libavformat/ftp.c
+++ b/libavformat/ftp.c
@@ -777,7 +777,11 @@ static int ftp_read(URLContext *h, unsigned char *buf,
int size)
 {
     FTPContext *s = h->priv_data;
     int read, err, retry_done = 0;
-
+    if(s->position >= s->filesize)
+    {
+        ff_dlog(h,"ftp protocol reach file end\n");
+        return AVERROR_EOF;
+    }
     ff_dlog(h, "ftp protocol read %d bytes\n", size);
   retry:
     if (s->state == DISCONNECTED) {


use follow command hang up

./ffmpeg -loglevel level+debug -i ftp://chiwailam:"abcd1234!"@
192.168.1.114/orgvideos/9926558478.avi -f null -

ffmpeg version:

 libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ftp_hang_because_not_return_eof.patch
Type: application/octet-stream
Size: 533 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180613/c5428e12/attachment.obj>


More information about the ffmpeg-devel mailing list