zikichombo / codec

Sound Codecs
BSD 3-Clause "New" or "Revised" License
16 stars 4 forks source link

codec.SeekingDecoder passes on a broken Reader #15

Closed jfreymuth closed 6 years ago

jfreymuth commented 6 years ago

codec.SeekingDecoder calls a codec's SeekingDecoder function with a *brCloser. This struct implements io.Reader via a bufio.Reader, but also exposes the Seek method of the underlying Reader, so calls to Read after calls to Seek return wrong data.

Also, a codec's Decoder function is called with a struct that can be type asserted to an io.Seeker, but it's Seek method always panics, which is not technically a bug, but very inconvenient with the way my oggvorbis package works.

wsc1 commented 6 years ago

Thanks for the comments.

I see how being castable to Seeker that only panics can be a problem. will think of a way around it.

For calls to read after seek, yes that's a bug. Note also this comment

which recognises another bug in codec.Codec and proposes to use an interface in its place.

I can get a new codec.Codec in place in the next two days or so. Could you help review the new version?

wsc1 commented 6 years ago

This PR I hope will address the issues you brought up.