X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Ffile.c;h=1d321c42050e31588a411583c4f9578254460ac0;hb=1b8ef01f04ab2210a26b59d3a1a62daed52ce88a;hp=264542a36a7dd05173b6de1ce2cd1af0d5900510;hpb=5786ee3eee7a88bf9faecc7246b35cfa64b31236;p=ffmpeg diff --git a/libavformat/file.c b/libavformat/file.c index 264542a36a7..1d321c42050 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -112,6 +112,8 @@ static int file_read(URLContext *h, unsigned char *buf, int size) ret = read(c->fd, buf, size); if (ret == 0 && c->follow) return AVERROR(EAGAIN); + if (ret == 0) + return AVERROR_EOF; return (ret == -1) ? AVERROR(errno) : ret; } @@ -227,6 +229,11 @@ static int file_open(URLContext *h, const char *filename, int flags) h->is_streamed = !fstat(fd, &st) && S_ISFIFO(st.st_mode); + /* Buffer writes more than the default 32k to improve throughput especially + * with networked file systems */ + if (!h->is_streamed && flags & AVIO_FLAG_WRITE) + h->min_packet_size = h->max_packet_size = 262144; + return 0; }