diff options
author | Martin Storsjö <martin@martin.st> | 2011-01-13 06:22:43 +0000 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2011-01-13 06:22:43 +0000 |
commit | c66f53cf8b3fd9fca0c0e30140eaeb9c16e58da2 (patch) | |
tree | c5ef94813f7c16a80ec777e07db458187aa0a1e8 /libavformat | |
parent | 891aeeee72b2d57d380ca097cc34be2b0c360233 (diff) | |
download | ffmpeg-c66f53cf8b3fd9fca0c0e30140eaeb9c16e58da2.tar.gz |
Revert aviobuf: Retry if the read/write function returns AVERROR(EAGAIN)
This reverts SVN commit 26318, which broke MS-RTSP playback.
Originally committed as revision 26326 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/aviobuf.c | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 5aff31c6c1..df76507866 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -19,9 +19,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -/* needed for usleep() */ -#define _XOPEN_SOURCE 600 -#include <unistd.h> #include "libavutil/crc.h" #include "libavutil/intreadwrite.h" #include "avformat.h" @@ -91,29 +88,11 @@ ByteIOContext *av_alloc_put_byte( return s; } -static inline int retry_transfer_wrapper(void *opaque, unsigned char *buf, - int size, - int (*transfer_func)(void *, unsigned char *, int)) { - int fast_retries = 5; - while (1) { - int ret = transfer_func(opaque, buf, size); - if (ret == AVERROR(EAGAIN)) { - if (fast_retries) - fast_retries--; - else - usleep(1000); - } else - return ret; - } -} - static void flush_buffer(ByteIOContext *s) { if (s->buf_ptr > s->buffer) { if (s->write_packet && !s->error){ - int ret= retry_transfer_wrapper(s->opaque, s->buffer, - s->buf_ptr - s->buffer, - s->write_packet); + int ret= s->write_packet(s->opaque, s->buffer, s->buf_ptr - s->buffer); if(ret < 0){ s->error = ret; } @@ -382,7 +361,7 @@ static void fill_buffer(ByteIOContext *s) } if(s->read_packet) - len = retry_transfer_wrapper(s->opaque, dst, len, s->read_packet); + len = s->read_packet(s->opaque, dst, len); else len = 0; if (len <= 0) { @@ -453,8 +432,7 @@ int get_buffer(ByteIOContext *s, unsigned char *buf, int size) if (len == 0) { if(size > s->buffer_size && !s->update_checksum){ if(s->read_packet) - len = retry_transfer_wrapper(s->opaque, buf, size, - s->read_packet); + len = s->read_packet(s->opaque, buf, size); if (len <= 0) { /* do not modify buffer if EOF reached so that a seek back can be done without rereading data */ |