How to decode AAC.

How to decode AAC.

billcruse's picture

hi...

I try to decode AAC data from RTSP stream. The GetFrame function wlways returns error (AAC_BAD_STREAM,UMC_ERR_INVALID_STREAM).
The code as follows.

a=rtpmap:98 mpeg4-generic/8000/2
a=fmtp:98 streamtype=5; profile-level-id=15; mode=AAC-hbr; config=1590; SizeLength=13;IndexLength=3; IndexDeltaLength=3; Profile=1;

pData ={

00 10 0a 60 21 0a 05 01 05 02 c2 10 a1 1c 89 b7 0c bb df 47 35 d6 6a f7 d4 e7 5c 65 3a e6 15 72
b4 ad 20 ec 5d bf 72 33 45 18 bc 4c 0c 4a 62 07 75 6d 01 8b e7 65 6d 75 91 66 7e 81 58 cc 7f fb
73 40 82 17 35 5c 9c 02 a2 0a e3 5d 09 b8 e8 2a b6 a8 a3 9a ac cf 90 02 86 f2 df 26 11 7f 3d fa\\
a3 4a 7c b9 29 73 f9 b1 cb 3f c3 a3 fe 28 46 3e 4b e9 d7 37 b0 dd fa 2f 31 e8 6c 11 85 10 48 6a
4f e8 d4 b9 70 db b8 b7 fe cb 6a 6d 8e e1 84 67 81 9e 33 6c 1c e8 11 0b 28 fc 8e 9e 97 24 2f 36
a6 5e 50 b4 d3 05 2f 7a 34 02 af d5 f1 ac 0c f7 62 3d 47 21 34 7d 02 8a 46 43 1a 7c a6 48 32 3f
52 c9 19 0b b6 f2 0c 76 7b b9 6f d0 c0 e9 ca d7 98 13 29 ba 7c f1 28 35 56 5c ae ac 30 ab 9a 9e
95 5e d8 b5 0d 75 13 13 db d5 d7 19 4e 89 50 f9 ea 4f eb 52 45 e9 f2 09 9f 36 ab af bf e2 3a 7a
ab 7d f9 9a b8 32 dc f5 f6 b4 98 d1 b3 8d 17 74 74 04 14 0b 08 42 84 72 20 7f 4e 19 77 be 8e 6b
ac 00 00 00 07 62 ed fb 91 9a 28 c5 e2 60 62 53 10 3b ab 68 0c 5f 3b 2b 6b ac 8b 33 f4 0a c6 63
ff db 9a 04 10 b9 aa e4 e0 15 10 57 1a c2 01 c0
};

iData=336;
resultSpecialHeaderSize = 4

// offset header
pData+=resultSpecialHeaderSize;
iData-=resultSpecialHeaderSize;

//UMC::AACDecoder
UMC::AudioCodec *pHandle=(UMC::AudioCodec *)m_pHandle;
UMC::MediaData *pDataIn=(UMC::MediaData *)m_pDataIn;
UMC::AudioData *pDataOut=(UMC::AudioData *)m_pDataOut;

pDataIn->SetBufferPointer(pData,iData);
pDataIn->SetDataSize(iData);

UMC::Status status ;

UMC::AudioCodecParams param;
param.m_info_in.sample_frequency = 8000;
param.m_info_in.bitrate = 32000;
param.m_info_in.bitPerSample = 16;
param.m_info_in.channels = 2;
param.m_info_in.stream_type = UMC::AAC_MPEG4_STREAM;
param.profile = AAC_PROFILE_MAIN;
param.m_pData = pDataIn;

if(pHandle->Init(&param)!=UMC::UMC_OK)
{
return false;
}

pDataIn->SetBufferPointer(pData,iData);
pDataIn->SetDataSize(iData);

if(!m_pDataOut)
{
m_pDataOut=PF_NEW(UMC::AudioData);
pDataOut=(UMC::AudioData *)m_pDataOut;
}

pDataOut->SetBufferPointer(pBuffer,iBuffer);

status = pHandle->GetFrame(pDataIn,pDataOut);
if(status!=UMC::UMC_OK)
return false;
(AAC_BAD_STREAM,UMC_ERR_INVALID_STREAM)

How to fix the error ?

Thx.

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
billcruse's picture

Attach AAC-Frame00~ACC-Frame59 data.

Thx

Attachments: 

AttachmentSize
Download AAC.rar23.54 KB
Vipin Kumar E K (Intel)'s picture

Have you tried the IPP samples? There are some good samples for AAC encoding and decoding in audio-video-codecs-samples

Vipin Kumar E K (Intel)'s picture

Actually, this is not a bug of AAC Decoder. Our decoder doesnt work with RTP packet, so stream should be properly prepared. First of all, you need to initialize decoder using AudioSpecifigConfig() (0x1590 in this case) and then pass audio data.You may find an example of this usage in the following forum discussion

http://software.intel.com/en-us/forums/showthread.php?t=74291

Vipin

Login to leave a comment.