diff mbox

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

Message ID CAMz1jDq1AcVLqzeT72DKECVcezZdFzi+v-09ykHgs7dWup+W2w@mail.gmail.com
State New
Headers show

Commit Message

Gj X June 13, 2018, 10:27 a.m. UTC
fix:
     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
diff mbox

Patch

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: