From: Hraban Luyat Date: Thu, 9 Jul 2015 12:27:32 +0000 (+0100) Subject: Set the callback buffer before it is invoked X-Git-Tag: v2.0.0~93^2 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=c9ae20a887907706394a7d495d9cc4bbad458cdb;p=go-opus.git Set the callback buffer before it is invoked --- diff --git a/stream.go b/stream.go index 07a5743..1544e4e 100644 --- a/stream.go +++ b/stream.go @@ -66,6 +66,7 @@ func (s *Stream) Init(read io.Reader) error { return fmt.Errorf("Reader must be non-nil") } s.read = read + s.buf = make([]byte, maxEncodedFrameSize) var errno C.int oggfile := C.op_open_callbacks( unsafe.Pointer(s), @@ -77,7 +78,6 @@ func (s *Stream) Init(read io.Reader) error { return opusfileerr(errno) } s.oggfile = oggfile - s.buf = make([]byte, maxEncodedFrameSize) return nil }