将amf0编码器和解码器放到codec/amf.go中,增加MallocSlice函数用于减少内存复制,

对写入avcc音频进行长度判断
This commit is contained in:
dexter
2023-01-16 09:22:16 +08:00
parent 964ac02169
commit 881fe5abd9
9 changed files with 342 additions and 55 deletions

View File

@@ -16,3 +16,15 @@ func TestBuffer(t *testing.T) {
}
})
}
func TestMallocSlice(t *testing.T) {
t.Run(t.Name(), func(t *testing.T) {
var a [][]byte = [][]byte{}
b := MallocSlice(&a)
if *b != nil {
t.Fail()
} else if *b = []byte{1}; a[0][0] != 1 {
t.Fail()
}
})
}