From d5ac3f831df1d1b75b4759f4a99c0a931ea8770d Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 2 Apr 2016 20:09:35 +0900 Subject: [PATCH] audio/vorbis: decode should accept io.ReadCloser --- exp/audio/vorbis/vorbis.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/exp/audio/vorbis/vorbis.go b/exp/audio/vorbis/vorbis.go index 1506efa65..5c5a62e72 100644 --- a/exp/audio/vorbis/vorbis.go +++ b/exp/audio/vorbis/vorbis.go @@ -5548,13 +5548,14 @@ func cFloatsToSlice(p *C.float, n int) []float32 { // decode accepts an ogg stream and returns a decorded stream. // The decorded format is 1 or 2-channel interleaved littleendian int16 values. -func decode(in io.Reader) ([]byte, int, int, error) { - // TODO: in should be io.ReadCloser - +func decode(in io.ReadCloser) ([]byte, int, int, error) { mem, err := ioutil.ReadAll(in) if err != nil { return nil, 0, 0, err } + if err := in.Close(); err != nil { + return nil, 0, 0, err + } channelNum := C.int(0) sampleRate := C.int(0) output := (*C.short)(nil)