diff options
author | wm4 <wm4@nowhere> | 2013-06-06 20:40:05 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-06-16 22:05:10 +0200 |
commit | 5999efb96478cefa33cf61e3ce2c9d872365cec6 (patch) | |
tree | 9c19bc8ef435510e066ffd47243391a64c89f8ad /demux | |
parent | 0d5e6084aed34a9e6f48a4a2cfaf095b17acb21b (diff) | |
download | mpv-5999efb96478cefa33cf61e3ce2c9d872365cec6.tar.bz2 mpv-5999efb96478cefa33cf61e3ce2c9d872365cec6.tar.xz |
stream: fix some aspects of EOF handling
The stream EOF flag should only be set when trying to read past the end
of the file (relatively similar to unix files). Always clear the EOF
flag on seeking. Trying to set it "properly" (depending whether data is
available at seek destination or not) might be an ok idea, but would
require attention to too many special cases. I suspect before this
commit (and in MPlayer etc. too), the EOF flag wasn't handled
consistently when the stream position was at the end of the file.
Fix one special case in ebml.c and stream_skip(): this function couldn't
distinguish between at-EOF and past-EOF either.
Diffstat (limited to 'demux')
-rw-r--r-- | demux/ebml.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/demux/ebml.c b/demux/ebml.c index 52332cd0c5..98ab1ef306 100644 --- a/demux/ebml.c +++ b/demux/ebml.c @@ -308,11 +308,10 @@ int ebml_read_skip_or_resync_cluster(stream_t *s, uint64_t *length) *length = len + l; int64_t pos = stream_tell(s); - stream_skip(s, len); // When reading corrupted elements, len will often be a random high number, - // and stream_skip() will set EOF. - if (s->eof) { + // and stream_skip() will fail when skipping past EOF. + if (!stream_skip(s, len)) { stream_seek(s, pos); goto resync; } |