diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2010-01-23 13:23:47 +0300 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2010-01-23 13:23:47 +0300 |
commit | ddb901b74d7a71b6d4968f7490d1932821b5f703 (patch) | |
tree | fdf6efce0fecdb92cd405c4b217d79559289309c /libavformat/avio.c | |
parent | 98287358e941a2173e05f7efd3630693b997459b (diff) |
Make url_read_complete retry on EAGAIN and return how much data it read
if it reached EOF, making it useful in more cases.
Originally committed as revision 21393 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/avio.c')
-rw-r--r-- | libavformat/avio.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/avio.c b/libavformat/avio.c index e91bc200db..706ba4a610 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -156,8 +156,10 @@ int url_read_complete(URLContext *h, unsigned char *buf, int size) len = 0; while (len < size) { ret = url_read(h, buf+len, size-len); - if (ret < 1) - return ret; + if (ret == AVERROR(EAGAIN)) { + ret = 0; + } else if (ret < 1) + return ret < 0 ? ret : len; len += ret; } return len; |