diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2010-10-06 11:18:38 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2010-10-06 11:18:38 +0000 |
commit | a46f7516eccd307416e5ecf8760749a3368ee815 (patch) | |
tree | 34210c950946b193a896ade87c9e9122d8e04074 | |
parent | e16c1569c08266b48644e23ca9fa58d87c7f5786 (diff) | |
download | ffmpeg-a46f7516eccd307416e5ecf8760749a3368ee815.tar.gz |
Factor retry_transfer_wrapper() out of url_read_complete()
Originally committed as revision 25367 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/avio.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libavformat/avio.c b/libavformat/avio.c index 4399878991..bf0d9d8ee5 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -215,14 +215,15 @@ int url_read(URLContext *h, unsigned char *buf, int size) return ret; } -int url_read_complete(URLContext *h, unsigned char *buf, int size) +static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int size, + int (*transfer_func)(URLContext *h, unsigned char *buf, int size)) { int ret, len; int fast_retries = 5; len = 0; while (len < size) { - ret = url_read(h, buf+len, size-len); + ret = transfer_func(h, buf+len, size-len); if (ret == AVERROR(EAGAIN)) { ret = 0; if (fast_retries) @@ -238,6 +239,11 @@ int url_read_complete(URLContext *h, unsigned char *buf, int size) return len; } +int url_read_complete(URLContext *h, unsigned char *buf, int size) +{ + return retry_transfer_wrapper(h, buf, size, url_read); +} + int url_write(URLContext *h, const unsigned char *buf, int size) { int ret; |