voaac-go/aacenc/encode_test.go
aam335 99260cfa70 fixed memory leaks
+ new interface
2019-01-22 15:04:54 +03:00

30 lines
625 B
Go

package aacenc
import (
"log"
"testing"
)
func TestBridge(t *testing.T) {
channels := 2
properLen := 1024 * channels
m := make([]int16, properLen, properLen)
aacEnc := New()
aacEnc.Init(VoAudioCodingAac)
ret := aacEnc.SetParamAac(44100, channels)
if ret != VoErrNone {
t.Error("SetParamAac failed")
}
b, errn := aacEnc.EncodePcmBlock(m)
if errn != VoErrNone {
t.Error("EncodePcmBlock failed on proper len", ErrorFromResult(errn))
}
log.Print("Encoded: ", len(b))
b, errn = aacEnc.EncodePcmBlock(m[1:])
if errn == VoErrNone {
t.Error("EncodePcmBlock failed on wrong len", ErrorFromResult(errn))
}
}