]> Sergey Matveev's repositories - go-opus.git/commitdiff
Fix error reporting in DecodeFloat32()
authorHraban Luyat <hraban@0brg.net>
Sat, 21 Feb 2015 03:53:24 +0000 (03:53 +0000)
committerHraban Luyat <hraban@0brg.net>
Sat, 21 Feb 2015 03:53:24 +0000 (03:53 +0000)
api.go

diff --git a/api.go b/api.go
index 9cd149bac911c37bd947273913a54cf78e1c4b8d..ea86a5286cf67ebe337082dac109ab565fa424af 100644 (file)
--- a/api.go
+++ b/api.go
@@ -99,7 +99,6 @@ func NewDecoder(sample_rate int, channels int) (*Decoder, error) {
 }
 
 func (dec *Decoder) DecodeFloat32(data []byte) ([]float32, error) {
-       var errno int
        // I don't know how big this frame will be, but this is the limit
        pcm := make([]float32, xMAX_FRAME_SIZE_MS*dec.sample_rate/1000)
        n := int(C.opus_decode_float(
@@ -110,7 +109,7 @@ func (dec *Decoder) DecodeFloat32(data []byte) ([]float32, error) {
                C.int(cap(pcm)),
                0))
        if n < 0 {
-               return nil, opuserr(errno)
+               return nil, opuserr(n)
        }
        return pcm[:n], nil
 }