Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: SOS! The ADTS decode allows fail! (Read 4144 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

SOS! The ADTS decode allows fail!

Hello Everybody: I want to make a AAC real-time recording stream from one computer and send to other computer,
so I download the faac-1.28 and faad2-2.7 and build them to DLL. I test them to work, but the decode allows not right.
please help. thanks.


The encode code:

   m_hFAACEncode = faacEncOpen(11025, 2, &m_dwSamplesInput, &m_dwMaxBytesOutput);   //return 2048, 1536
   m_pstFAACFormat = faacEncGetCurrentConfiguration(m_hFAACEncode);

   m_pstFAACFormat->mpegVersion = MPEG2;
   m_pstFAACFormat->aacObjectType = LOW;
   m_pstFAACFormat->useLfe = 0;
   m_pstFAACFormat->inputFormat = FAAC_INPUT_16BIT;
   m_pstFAACFormat->outputFormat = 1;
   faacEncSetConfiguration(m_hFAACEncode, m_pstFAACFormat);

   ......

   LONG lEncodeLen = faacEncEncode(m_hFAACEncode, (int32_t *)pucInput, 2048, pucEncodeOut, 1536);

After 4 times encode(1--3 Encode return 0), I get lEncodeLen is 653, I can get right output stream of ADTS format below: 

0x003C8CC0  ff f9 68 80 51 bf fc de 04 00 00 6c 69 62 66 61 61 63 20 31 2e 32 38 00  ..h€Q......libfaac 1.28.
0x003C8CD8  00 42 15 1d 39 ff b5 bf fd f1 88 81 61 a0 58 a8 26 0a 11 82 82 60 a0 d8  .B..9.......a.X.&....`..
0x003C8CF0  28 12 0a 1d 84 81 50 a3 ce d9 a9 df 9d d4 eb 74 aa 1a da 5e 67 18 08 57  (.....P........t...^g..W
0x003C8D08  03 eb b7 db b3 fb bb b3 85 ff d7 fc a9 2e 4e ff f9 1b 4d f5 47 64 94 78  ..............N...M.Gd.x
0x003C8D20  bb 6f e2 3b 37 4f 3c bf 3f 5f 4c b3 81 ef d8 11 76 51 94 65 b7 4c e3 de  .o.;7O<.?_L.....vQ.e.L..
0x003C8D38  cb f8 7b ab b3 ff da 78 ef 9d 4a 3f f7 47 df e9 84 7b 86 af dd f6 9e 21  ..{....x..J?.G...{.....!
0x003C8D50  f8 9e 39 f5 c1 ec 93 28 a2 c1 fd 7f 87 fe c1 fb 25 ff e2 b4 95 4b 2b a7  ..9....(........%....K+.
0x003C8D68  1f 9f fa 93 57 4b ce 74 79 6f dd a4 63 bf 48 8c 3f f9 0e a6 32 cb 6c 94  ....WK.tyo..c.H.?...2.l.


Then I put the encode stream to NeAACDecDecode.


The decode code:
   m_hFAAD2Decode = NeAACDecOpen();
   m_pstFAAD2Format = NeAACDecGetCurrentConfiguration(m_hFAAD2Decode);

   m_pstFAAD2Format->defObjectType = LC;
   m_pstFAAD2Format->defSampleRate = 11025;
   m_pstFAAD2Format->outputFormat = FAAD_FMT_16BIT;
   m_pstFAAD2Format->dontUpSampleImplicitSBR = 1;

   NeAACDecSetConfiguration(m_hFAAD2Decode, m_pstFAAD2Format);

   NeAACDecInit(m_hFAAD2Decode, NULL, 0, &m_dwSampleRate, &m_ucChannels);   //return 11025, 2

   ......

   NeAACDecDecode(m_hFAAD2Decode, pstDecodeInfo, (BYTE *)pucEncodeOut, lEncodeLen);   //lEncodeLen is 653

   But the decode allows return NULL, and 12 == pstDecodeInfo.error

Why?! Who can tell me where I wrong or give me a sample? Thanks.