Added Fill to Decoder

This commit is contained in:
DataHoarder 2022-04-17 04:04:59 +02:00
parent e9cb84c52f
commit 7018d91e3e
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk
3 changed files with 85 additions and 56 deletions

View file

@ -325,33 +325,25 @@ func (v *AacDecoder) Close() error {
// Fill the buffer of decoder then decode.
// @remark we always expect all input are consumed by decoder.
func (v *AacDecoder) fill(input []byte) (err error) {
func (v *AacDecoder) Fill(input []byte) (n int, err error) {
p := (*C.char)(unsafe.Pointer(&input[0]))
pSize := C.int(len(input))
leftSize := C.int(0)
r := C.aacdec_fill(&v.m, p, pSize, &leftSize)
n = int(leftSize)
if int(r) != 0 {
return fmt.Errorf("fill aac decoder failed, code is %d", int(r))
}
if int(leftSize) > 0 {
return fmt.Errorf("decoder left %v bytes", int(leftSize))
return 0, fmt.Errorf("fill aac decoder failed, code is %d", int(r))
}
return
}
// Decode one audio frame.
// Decode one audio frame, previously filled by Fill
// @param the frame contains encoded aac frame, optional can be nil.
// @eturn when pcm is nil, should fill more bytes and decode again.
func (v *AacDecoder) Decode(frame []byte) (pcm []byte, err error) {
if len(frame) > 0 {
if err = v.fill(frame); err != nil {
return
}
}
func (v *AacDecoder) Decode() (pcm []byte, err error) {
nbPcm := int(C.aacdec_pcm_size(&v.m))
if nbPcm == 0 {

View file

@ -90,13 +90,15 @@ func TestRawDecode(t *testing.T) {
}
defer d.Close()
if b, err := d.Decode([]byte{
d.Fill([]byte{
0x21, 0x17, 0x55, 0x35, 0xa1, 0x0c, 0x2f, 0x00, 0x00, 0x50, 0x23, 0xa6, 0x81, 0xbf, 0x9c, 0xbf,
0x13, 0x73, 0xa9, 0xb0, 0x41, 0xed, 0x60, 0x23, 0x48, 0xf7, 0x34, 0x07, 0x12, 0x53, 0xd8, 0xeb,
0x49, 0xf4, 0x1e, 0x73, 0xc9, 0x01, 0xfd, 0x16, 0x9f, 0x8e, 0xb5, 0xd5, 0x9b, 0xb6, 0x49, 0xdb,
0x35, 0x61, 0x3b, 0x54, 0xad, 0x5f, 0x9d, 0x34, 0x94, 0x88, 0x58, 0x89, 0x33, 0x54, 0x89, 0xc4,
0x09, 0x80, 0xa2, 0xa1, 0x28, 0x81, 0x42, 0x10, 0x48, 0x94, 0x05, 0xfb, 0x03, 0xc7, 0x64, 0xe1,
0x54, 0x17, 0xf6, 0x65, 0x15, 0x00, 0x48, 0xa9, 0x80, 0x00, 0x38}); err != nil {
0x54, 0x17, 0xf6, 0x65, 0x15, 0x00, 0x48, 0xa9, 0x80, 0x00, 0x38})
if b, err := d.Decode(); err != nil {
t.Error("decode failed, err is", err)
return
} else if len(b) != 4096 {
@ -115,13 +117,15 @@ func TestRawDecode_MultipleFrames(t *testing.T) {
}
defer d.Close()
if b, err := d.Decode([]byte{
d.Fill([]byte{
0x21, 0x17, 0x55, 0x55, 0x19, 0x1a, 0x2a, 0x2d, 0x54, 0xce, 0x00, 0x58, 0x1a, 0x1e, 0x42, 0x0e,
0x1f, 0xd2, 0xd4, 0x9c, 0x15, 0x77, 0xf4, 0x07, 0x38, 0x3d, 0xc5, 0x04, 0x19, 0x64, 0x39, 0x98,
0x01, 0xae, 0x2e, 0xb1, 0xd0, 0x87, 0xca, 0x33, 0x17, 0xfb, 0x05, 0x00, 0x7a, 0x60, 0x47, 0x79,
0x6b, 0x9b, 0xdf, 0x2d, 0xfd, 0x32, 0xc6, 0x9f, 0x1f, 0x21, 0x4b, 0x04, 0x9b, 0xe2, 0x4d, 0x62,
0xc8, 0x01, 0xe0, 0x98, 0x0a, 0x37, 0x48, 0x44, 0x42, 0x02, 0x00, 0xd0, 0x7d, 0xae, 0xb4, 0x32,
0xf1, 0xcc, 0x76, 0x5f, 0x18, 0xac, 0xae, 0x0e}); err != nil {
0xf1, 0xcc, 0x76, 0x5f, 0x18, 0xac, 0xae, 0x0e})
if b, err := d.Decode(); err != nil {
t.Error("fill failed, err is", err)
return
} else if len(b) != 4096 {
@ -129,12 +133,14 @@ func TestRawDecode_MultipleFrames(t *testing.T) {
return
}
if b, err := d.Decode([]byte{
d.Fill([]byte{
0x21, 0x17, 0x55, 0x5c, 0x21, 0x12, 0xc2, 0x15, 0x04, 0x17, 0x94, 0x50, 0xb0, 0xaf, 0x3a, 0x34,
0x12, 0x7f, 0xee, 0x54, 0xac, 0xe2, 0x57, 0x57, 0xf7, 0x19, 0x18, 0xc5, 0x08, 0xc9, 0xaa, 0x21,
0x75, 0x2c, 0xc9, 0x4f, 0x6f, 0xc7, 0xe2, 0xfb, 0x44, 0x72, 0x47, 0x71, 0x4a, 0x88, 0x9b, 0xfe,
0x0c, 0x83, 0x02, 0x1a, 0xc9, 0x59, 0x7a, 0x48, 0x98, 0xac, 0x02, 0xab, 0x64, 0x22, 0x32, 0xcd,
0x50, 0x3d, 0x80, 0x16, 0x22, 0x70, 0xb0, 0x7b, 0x00, 0x53, 0xef, 0x7c, 0xbc}); err != nil {
0x50, 0x3d, 0x80, 0x16, 0x22, 0x70, 0xb0, 0x7b, 0x00, 0x53, 0xef, 0x7c, 0xbc})
if b, err := d.Decode(); err != nil {
t.Error("fill failed, err is", err)
return
} else if len(b) != 4096 {
@ -142,13 +148,15 @@ func TestRawDecode_MultipleFrames(t *testing.T) {
return
}
if b, err := d.Decode([]byte{
d.Fill([]byte{
0x21, 0x17, 0x55, 0x4d, 0x1d, 0x4d, 0x01, 0x42, 0x8a, 0x80, 0x19, 0x01, 0x8b, 0x0b, 0xe0, 0x02,
0x24, 0x7d, 0x8e, 0x08, 0xf2, 0x65, 0x64, 0xef, 0x02, 0x80, 0xf2, 0x72, 0xe4, 0xea, 0x19, 0x9c,
0xd6, 0x90, 0xb8, 0x6f, 0xd4, 0x28, 0x74, 0xb9, 0xdd, 0x80, 0x6a, 0xfe, 0x09, 0x0e, 0xa4, 0xb7,
0x83, 0x7f, 0xf8, 0x80, 0xa4, 0xa1, 0xd6, 0xb3, 0x6d, 0xbd, 0xe5, 0xe3, 0xc7, 0x00, 0xa0, 0x50,
0x17, 0x49, 0x96, 0x8b, 0x9a, 0x17, 0x40, 0x02, 0xa8, 0x50, 0x15, 0x03, 0x7a, 0x1c, 0x01, 0x5c,
0x9c}); err != nil {
0x9c})
if b, err := d.Decode(); err != nil {
t.Error("fill failed, err is", err)
return
} else if len(b) != 4096 {
@ -166,13 +174,15 @@ func TestAdtsDecode_Partial(t *testing.T) {
}
defer d.Close()
if b, err := d.Decode([]byte{0xff, 0xf1, 0x50, 0x80, 0x0c, 0x40, 0xfc,
d.Fill([]byte{0xff, 0xf1, 0x50, 0x80, 0x0c, 0x40, 0xfc,
0x21, 0x17, 0x55, 0x35, 0xa1, 0x0c, 0x2f, 0x00, 0x00, 0x50, 0x23, 0xa6, 0x81, 0xbf, 0x9c, 0xbf,
0x13, 0x73, 0xa9, 0xb0, 0x41, 0xed, 0x60, 0x23, 0x48, 0xf7, 0x34, 0x07, 0x12, 0x53, 0xd8, 0xeb,
0x49, 0xf4, 0x1e, 0x73, 0xc9, 0x01, 0xfd, 0x16, 0x9f, 0x8e, 0xb5, 0xd5, 0x9b, 0xb6, 0x49, 0xdb,
0x35, 0x61, 0x3b, 0x54, 0xad, 0x5f, 0x9d, 0x34, 0x94, 0x88, 0x58, 0x89, 0x33, 0x54, 0x89, 0xc4,
0x09, 0x80, 0xa2, 0xa1, 0x28, 0x81, 0x42, 0x10, 0x48, 0x94, 0x05, 0xfb, 0x03, 0xc7, 0x64, 0xe1,
0x54}); err != nil {
0x54})
if b, err := d.Decode(); err != nil {
t.Error("fill failed, err is", err)
return
} else if len(b) != 0 {
@ -180,9 +190,11 @@ func TestAdtsDecode_Partial(t *testing.T) {
return
}
if b, err := d.Decode([]byte{0x17, 0xf6, 0x65, 0x15, 0x00, 0x48, 0xa9, 0x80, 0x00, 0x38,
d.Fill([]byte{0x17, 0xf6, 0x65, 0x15, 0x00, 0x48, 0xa9, 0x80, 0x00, 0x38,
0xff, 0xf1, 0x50, 0x80, 0x0c, 0x40, 0xfc,
0x21, 0x17, 0x55, 0x35, 0xa1, 0x0c, 0x2f, 0x00, 0x00, 0x50, 0x23, 0xa6, 0x81, 0xbf, 0x9c, 0xbf}); err != nil {
0x21, 0x17, 0x55, 0x35, 0xa1, 0x0c, 0x2f, 0x00, 0x00, 0x50, 0x23, 0xa6, 0x81, 0xbf, 0x9c, 0xbf})
if b, err := d.Decode(); err != nil {
t.Error("fill failed, err is", err)
return
} else if len(b) != 4096 {
@ -190,11 +202,13 @@ func TestAdtsDecode_Partial(t *testing.T) {
return
}
if b, err := d.Decode([]byte{
d.Fill([]byte{
0x13, 0x73, 0xa9, 0xb0, 0x41, 0xed, 0x60, 0x23, 0x48, 0xf7, 0x34, 0x07, 0x12, 0x53, 0xd8, 0xeb,
0x49, 0xf4, 0x1e, 0x73, 0xc9, 0x01, 0xfd, 0x16, 0x9f, 0x8e, 0xb5, 0xd5, 0x9b, 0xb6, 0x49, 0xdb,
0x35, 0x61, 0x3b, 0x54, 0xad, 0x5f, 0x9d, 0x34, 0x94, 0x88, 0x58, 0x89, 0x33, 0x54, 0x89, 0xc4,
0x09, 0x80, 0xa2, 0xa1, 0x28, 0x81, 0x42, 0x10, 0x48, 0x94, 0x05, 0xfb, 0x03, 0xc7, 0x64, 0xe1}); err != nil {
0x09, 0x80, 0xa2, 0xa1, 0x28, 0x81, 0x42, 0x10, 0x48, 0x94, 0x05, 0xfb, 0x03, 0xc7, 0x64, 0xe1})
if b, err := d.Decode(); err != nil {
t.Error("fill failed, err is", err)
return
} else if len(b) != 0 {
@ -202,7 +216,9 @@ func TestAdtsDecode_Partial(t *testing.T) {
return
}
if b, err := d.Decode([]byte{0x54, 0x17, 0xf6, 0x65, 0x15, 0x00, 0x48, 0xa9, 0x80, 0x00, 0x38}); err != nil {
d.Fill([]byte{0x54, 0x17, 0xf6, 0x65, 0x15, 0x00, 0x48, 0xa9, 0x80, 0x00, 0x38})
if b, err := d.Decode(); err != nil {
t.Error("fill failed, err is", err)
return
} else if len(b) != 4096 {
@ -220,7 +236,7 @@ func TestAdtsDecode_Partial2(t *testing.T) {
}
defer d.Close()
if b, err := d.Decode([]byte{
d.Fill([]byte{
// frame#0
0xff, 0xf1, 0x50, 0x80, 0x0e, 0x60, 0xfc,
0x21, 0x17, 0x55, 0x45, 0x0d, 0x88, 0x90, 0x13, 0x04, 0x2c, 0xa4, 0x01, 0x01, 0xd0, 0x20, 0x3e,
@ -232,7 +248,9 @@ func TestAdtsDecode_Partial2(t *testing.T) {
0x18, 0xe7, 0xad, 0xda, 0xc2, 0xcc, 0x09, 0x04, 0xa6, 0x90, 0x91, 0xc0,
// frame#1
0xff, 0xf1, 0x50, 0x80,
}); err != nil {
})
if b, err := d.Decode(); err != nil {
t.Error("fill failed, err is", err)
return
} else if len(b) != 4096 {
@ -243,12 +261,12 @@ func TestAdtsDecode_Partial2(t *testing.T) {
// this will drop frame#1 and cause sync error.
// but we fix it, so it will return an empty pcm
// and the frame#1 is keep in internal buffer.
if _, err := d.Decode(nil); err != nil {
if _, err := d.Decode(); err != nil {
t.Error("fill failed, err is", err)
return
}
if b, err := d.Decode([]byte{
d.Fill([]byte{
// frame#1 continue
0x0d, 0x40, 0xfc, 0x21, 0x17, 0x55, 0x45, 0x95, 0x18, 0x2c, 0x05, 0x44, 0x10, 0x00, 0xd6, 0x97,
0x40, 0x7b, 0xe4, 0xb1, 0xcb, 0xcb, 0xd1, 0xa8, 0xc6, 0x40, 0x7d, 0x7c, 0xb3, 0x64, 0xd1, 0x4a,
@ -266,7 +284,9 @@ func TestAdtsDecode_Partial2(t *testing.T) {
0xab, 0x7b, 0x28, 0x0a, 0x66, 0x30, 0x90, 0x0a, 0x6a, 0x02, 0x16, 0xb0, 0x50, 0x06, 0x83, 0x6e,
0xfa, 0xea, 0xe1, 0xd7, 0x30, 0xf0, 0x9b, 0x18, 0x25, 0xfc, 0x6b, 0x42, 0x5a, 0x3c, 0x5e, 0x3c,
0x18, 0xe7, 0xad, 0xda, 0xc2, 0xcc, 0x09, 0x04, 0xa6, 0x90, 0x91, 0xc0,
}); err != nil {
})
if b, err := d.Decode(); err != nil {
t.Error("fill failed, err is", err)
return
} else if len(b) != 4096 {
@ -275,7 +295,7 @@ func TestAdtsDecode_Partial2(t *testing.T) {
}
// for we fix the bug, we can got the frame#2.
if b, err := d.Decode(nil); err != nil {
if b, err := d.Decode(); err != nil {
t.Error("fill failed, err is", err)
return
} else if len(b) != 4096 {
@ -294,18 +314,22 @@ func TestRawDecode_Partial(t *testing.T) {
}
defer d.Close()
if _, err := d.Decode([]byte{0xff, 0xf1, 0x50, 0x80, 0x0c, 0x40, 0xfc,
d.Fill([]byte{0xff, 0xf1, 0x50, 0x80, 0x0c, 0x40, 0xfc,
0x21, 0x17, 0x55, 0x35, 0xa1, 0x0c, 0x2f, 0x00, 0x00, 0x50, 0x23, 0xa6, 0x81, 0xbf, 0x9c, 0xbf,
0x13, 0x73, 0xa9, 0xb0, 0x41, 0xed, 0x60, 0x23, 0x48, 0xf7, 0x34, 0x07, 0x12, 0x53, 0xd8, 0xeb,
0x49, 0xf4, 0x1e, 0x73, 0xc9, 0x01, 0xfd, 0x16, 0x9f, 0x8e, 0xb5, 0xd5, 0x9b, 0xb6, 0x49, 0xdb,
0x35, 0x61, 0x3b, 0x54, 0xad, 0x5f, 0x9d, 0x34, 0x94, 0x88, 0x58, 0x89, 0x33, 0x54, 0x89, 0xc4,
0x09, 0x80, 0xa2, 0xa1, 0x28, 0x81, 0x42, 0x10, 0x48, 0x94, 0x05, 0xfb, 0x03, 0xc7, 0x64, 0xe1,
0x54}); err == nil {
0x54})
if _, err := d.Decode(); err == nil {
t.Error("fill failed, err is", err)
return
}
if _, err := d.Decode([]byte{0x17, 0xf6, 0x65, 0x15, 0x00, 0x48, 0xa9, 0x80, 0x00, 0x38}); err == nil {
d.Fill([]byte{0x17, 0xf6, 0x65, 0x15, 0x00, 0x48, 0xa9, 0x80, 0x00, 0x38})
if _, err := d.Decode(); err == nil {
t.Error("fill failed, err is", err)
return
}

View file

@ -37,15 +37,17 @@ func ExampleAacDecoder_RAW() {
}
defer d.Close()
// directly decode the frame to pcm.
var pcm []byte
if pcm, err = d.Decode([]byte{
d.Fill([]byte{
0x21, 0x17, 0x55, 0x35, 0xa1, 0x0c, 0x2f, 0x00, 0x00, 0x50, 0x23, 0xa6, 0x81, 0xbf, 0x9c, 0xbf,
0x13, 0x73, 0xa9, 0xb0, 0x41, 0xed, 0x60, 0x23, 0x48, 0xf7, 0x34, 0x07, 0x12, 0x53, 0xd8, 0xeb,
0x49, 0xf4, 0x1e, 0x73, 0xc9, 0x01, 0xfd, 0x16, 0x9f, 0x8e, 0xb5, 0xd5, 0x9b, 0xb6, 0x49, 0xdb,
0x35, 0x61, 0x3b, 0x54, 0xad, 0x5f, 0x9d, 0x34, 0x94, 0x88, 0x58, 0x89, 0x33, 0x54, 0x89, 0xc4,
0x09, 0x80, 0xa2, 0xa1, 0x28, 0x81, 0x42, 0x10, 0x48, 0x94, 0x05, 0xfb, 0x03, 0xc7, 0x64, 0xe1,
0x54, 0x17, 0xf6, 0x65, 0x15, 0x00, 0x48, 0xa9, 0x80, 0x00, 0x38}); err != nil {
0x54, 0x17, 0xf6, 0x65, 0x15, 0x00, 0x48, 0xa9, 0x80, 0x00, 0x38})
// directly decode the frame to pcm.
var pcm []byte
if pcm, err = d.Decode(); err != nil {
fmt.Println("decode failed, err is", err)
return
}
@ -102,14 +104,16 @@ func ExampleAacDecoder_ADTS() {
}
defer d.Close()
var pcm []byte
if pcm, err = d.Decode([]byte{0xff, 0xf1, 0x50, 0x80, 0x0c, 0x40, 0xfc,
d.Fill([]byte{0xff, 0xf1, 0x50, 0x80, 0x0c, 0x40, 0xfc,
0x21, 0x17, 0x55, 0x35, 0xa1, 0x0c, 0x2f, 0x00, 0x00, 0x50, 0x23, 0xa6, 0x81, 0xbf, 0x9c, 0xbf,
0x13, 0x73, 0xa9, 0xb0, 0x41, 0xed, 0x60, 0x23, 0x48, 0xf7, 0x34, 0x07, 0x12, 0x53, 0xd8, 0xeb,
0x49, 0xf4, 0x1e, 0x73, 0xc9, 0x01, 0xfd, 0x16, 0x9f, 0x8e, 0xb5, 0xd5, 0x9b, 0xb6, 0x49, 0xdb,
0x35, 0x61, 0x3b, 0x54, 0xad, 0x5f, 0x9d, 0x34, 0x94, 0x88, 0x58, 0x89, 0x33, 0x54, 0x89, 0xc4,
0x09, 0x80, 0xa2, 0xa1, 0x28, 0x81, 0x42, 0x10, 0x48, 0x94, 0x05, 0xfb, 0x03, 0xc7, 0x64, 0xe1,
0x54, 0x17, 0xf6, 0x65, 0x15, 0x00, 0x48, 0xa9, 0x80, 0x00, 0x38}); err != nil {
0x54, 0x17, 0xf6, 0x65, 0x15, 0x00, 0x48, 0xa9, 0x80, 0x00, 0x38})
var pcm []byte
if pcm, err = d.Decode(); err != nil {
fmt.Println("decode failed, err is", err)
return
}
@ -169,14 +173,17 @@ func ExampleAacDecoder_ADTS_Stream_NotEnoughBits() {
// Fill then decode, aac stream.
// AAC Frame #0, part 0
var pcm []byte
if pcm, err = d.Decode([]byte{0xff, 0xf1, 0x50, 0x80, 0x0c, 0x40, 0xfc,
d.Fill([]byte{0xff, 0xf1, 0x50, 0x80, 0x0c, 0x40, 0xfc,
0x21, 0x17, 0x55, 0x35, 0xa1, 0x0c, 0x2f, 0x00, 0x00, 0x50, 0x23, 0xa6, 0x81, 0xbf, 0x9c, 0xbf,
0x13, 0x73, 0xa9, 0xb0, 0x41, 0xed, 0x60, 0x23, 0x48, 0xf7, 0x34, 0x07, 0x12, 0x53, 0xd8, 0xeb,
0x49, 0xf4, 0x1e, 0x73, 0xc9, 0x01, 0xfd, 0x16, 0x9f, 0x8e, 0xb5, 0xd5, 0x9b, 0xb6, 0x49, 0xdb,
0x35, 0x61, 0x3b, 0x54, 0xad, 0x5f, 0x9d, 0x34, 0x94, 0x88, 0x58, 0x89, 0x33, 0x54, 0x89, 0xc4,
0x09, 0x80, 0xa2, 0xa1, 0x28, 0x81, 0x42, 0x10, 0x48, 0x94, 0x05, 0xfb, 0x03, 0xc7, 0x64, 0xe1,
0x54}); err != nil {
0x54})
var pcm []byte
if pcm, err = d.Decode(); err != nil {
fmt.Println("fill decoder failed, err is", err)
return
}
@ -185,8 +192,10 @@ func ExampleAacDecoder_ADTS_Stream_NotEnoughBits() {
return
}
d.Fill([]byte{0x17, 0xf6, 0x65, 0x15, 0x00, 0x48, 0xa9, 0x80, 0x00, 0x38})
// AAC Frame #0, part 1
if pcm, err = d.Decode([]byte{0x17, 0xf6, 0x65, 0x15, 0x00, 0x48, 0xa9, 0x80, 0x00, 0x38}); err != nil {
if pcm, err = d.Decode(); err != nil {
fmt.Println("fill decoder failed, err is", err)
return
}
@ -243,28 +252,32 @@ func ExampleAacDecoder_ADTS_Frames() {
}
defer d.Close()
// AAC FRAME #0
var pcm0 []byte
if pcm0, err = d.Decode([]byte{0xff, 0xf1, 0x50, 0x80, 0x0c, 0x40, 0xfc,
d.Fill([]byte{0xff, 0xf1, 0x50, 0x80, 0x0c, 0x40, 0xfc,
0x21, 0x17, 0x55, 0x35, 0xa1, 0x0c, 0x2f, 0x00, 0x00, 0x50, 0x23, 0xa6, 0x81, 0xbf, 0x9c, 0xbf,
0x13, 0x73, 0xa9, 0xb0, 0x41, 0xed, 0x60, 0x23, 0x48, 0xf7, 0x34, 0x07, 0x12, 0x53, 0xd8, 0xeb,
0x49, 0xf4, 0x1e, 0x73, 0xc9, 0x01, 0xfd, 0x16, 0x9f, 0x8e, 0xb5, 0xd5, 0x9b, 0xb6, 0x49, 0xdb,
0x35, 0x61, 0x3b, 0x54, 0xad, 0x5f, 0x9d, 0x34, 0x94, 0x88, 0x58, 0x89, 0x33, 0x54, 0x89, 0xc4,
0x09, 0x80, 0xa2, 0xa1, 0x28, 0x81, 0x42, 0x10, 0x48, 0x94, 0x05, 0xfb, 0x03, 0xc7, 0x64, 0xe1,
0x54, 0x17, 0xf6, 0x65, 0x15, 0x00, 0x48, 0xa9, 0x80, 0x00, 0x38}); err != nil {
0x54, 0x17, 0xf6, 0x65, 0x15, 0x00, 0x48, 0xa9, 0x80, 0x00, 0x38})
// AAC FRAME #0
var pcm0 []byte
if pcm0, err = d.Decode(); err != nil {
fmt.Println("decode failed, err is", err)
return
}
// AAC FRAME #1
var pcm1 []byte
if pcm1, err = d.Decode([]byte{0xff, 0xf1, 0x50, 0x80, 0x0b, 0xe0, 0xfc,
d.Fill([]byte{0xff, 0xf1, 0x50, 0x80, 0x0b, 0xe0, 0xfc,
0x21, 0x17, 0x55, 0x55, 0x19, 0x1a, 0x2a, 0x2d, 0x54, 0xce, 0x00, 0x58, 0x1a, 0x1e, 0x42, 0x0e,
0x1f, 0xd2, 0xd4, 0x9c, 0x15, 0x77, 0xf4, 0x07, 0x38, 0x3d, 0xc5, 0x04, 0x19, 0x64, 0x39, 0x98,
0x01, 0xae, 0x2e, 0xb1, 0xd0, 0x87, 0xca, 0x33, 0x17, 0xfb, 0x05, 0x00, 0x7a, 0x60, 0x47, 0x79,
0x6b, 0x9b, 0xdf, 0x2d, 0xfd, 0x32, 0xc6, 0x9f, 0x1f, 0x21, 0x4b, 0x04, 0x9b, 0xe2, 0x4d, 0x62,
0xc8, 0x01, 0xe0, 0x98, 0x0a, 0x37, 0x48, 0x44, 0x42, 0x02, 0x00, 0xd0, 0x7d, 0xae, 0xb4, 0x32,
0xf1, 0xcc, 0x76, 0x5f, 0x18, 0xac, 0xae, 0x0e}); err != nil {
0xf1, 0xcc, 0x76, 0x5f, 0x18, 0xac, 0xae, 0x0e})
// AAC FRAME #1
var pcm1 []byte
if pcm1, err = d.Decode(); err != nil {
fmt.Println("decode failed, err is", err)
return
}