RustAudio / ogg

Ogg container decoder and encoder written in pure Rust
Other
113 stars 21 forks source link

Dealing with junk at the end of a file? #7

Open est31 opened 6 years ago

est31 commented 6 years ago

The square-with-junk.ogg file from the libnogg test suite has junk at the end of the file. This doesn't seem to be a problem for libvorbis or libnogg. But the ogg returns an error instead of end of stream when it encounters that junk (it reads past the other junk in the file just fine).

If we want to tolerate this trailing junk, we need to be able to distinguish between a reader where we had already read valid ogg stuff, and one where we hadn't, so that we don't return "no pages" when encountering a non-ogg file. A non ogg file is different from an empty file!

This ability to distinguish requires us to store more state, and I'm not sure whether it's worth it.

est31 commented 6 years ago

See also https://github.com/RustAudio/lewton/commit/eb231f72d90e01fa2c0bab59e6cda87a38bf4078