Mercurial > mplayer.hg
changeset 32867:454f6decbd93
When reading from a stream fails, try one more time after a reset.
This should re-establish for example timed-out network connections.
Fixes bug #1841.
author | reimar |
---|---|
date | Tue, 22 Feb 2011 22:27:01 +0000 |
parents | 9acb64ec6484 |
children | f9d70de26708 |
files | stream/stream.c |
diffstat | 1 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/stream/stream.c Tue Feb 22 18:58:50 2011 +0000 +++ b/stream/stream.c Tue Feb 22 22:27:01 2011 +0000 @@ -304,7 +304,19 @@ default: len= s->fill_buffer ? s->fill_buffer(s, buf, len) : 0; } - if(len<=0){ s->eof=1; return 0; } + if(len<=0){ + if (!s->eof) { + // just in case this is an error e.g. due to network + // timeout reset and retry + off_t pos = s->pos; + stream_reset(s); + stream_seek_internal(s, pos); + s->eof=1; + return stream_read_internal(s, buf, len); + } + s->eof=1; + return 0; + } // When reading succeeded we are obviously not at eof. // This e.g. avoids issues with eof getting stuck when lavf seeks in MPEG-TS s->eof=0;