AMR decoding corrupting the heap
| Mon, 2005-02-07 13:16 | |
|
Hi,
I am converting AMR data to raw PCM into descriptor. Since descriptor things are not working using CMdaAudioConvertutility(known issue in this forum), I started to use older version of AMR decoder using CAmrToPcmDecoder. The decoding process goes fine but certain issues comes after that. here it goes: 1. After the decoding ( AMR to PCM ) completes the first few 25-30 bytes always show data as 00. I didn't get the reason why? 2. After the decoding completes the program heap gets corrupted. I am not able to create a single object after decoding is completed. This is a major problem which is stopping my work. Could anyone give advice on this? I am using symbian 7.0 s60 2.1 here is a code snippet. TInt opbufsize = 0; TInt i = 0; TInt j = 0; TInt ipoff =0; TInt opoff = 0; TDes8* outputBuff = new(ELeave) TBuf8<500>; outputBuff->SetMax(); TUint8 *opBuff = (TUint8*)(outputBuff->Ptr()); TAmrDecParams decodeparams; CAmrToPcmDecoder *decoder = CAmrToPcmDecoder::NewL(decodeparams); TUint8 *ipBuff = (TUint8*)(aAmrbuf->Ptr()); TInt availbaleblock; TInt heaplen; User::Check(); heaplen= User::Available(availbaleblock); TInt err = 0; while(ipbufsize>0) { err = decoder->Decode(ipBuff + ipoff, i, opBuff + opoff, j, EFalse); ipoff = ipoff + i; opoff = opoff + j; ipbufsize = ipbufsize - i; opbufsize = opbufsize + j; } // Note: ************************************** // The decoder is corrupting the heap. Heap Check is failing. /// ************************************** User::Check(); heaplen= User::Available(availbaleblock); HBufC8 *buf; buf = HBufC8::NewL(500); User::Check(); heaplen= User::Available(availbaleblock); -void* |
|






Forum posts: 29
i tried the code, used 13 bytes(frame size from FrameInfo() function, 4.75 kbps amr) buffers to read from amr file, 320 bytes buffers are occured after Decode(),
i sent them to a RPointerArray, then after all the buffers of amr processed, i wrote the array elements to a file from 0 to end.
then i tried to play it with decodertest example (http://forum.newlc.com/index.php?topic=968.0) which plays popular testing123.raw successfully.
am i doing a silly mistake?
i'm at the end of the way with CAmrToPcmDecoder, i have no idea about what the problem is, and it's really hard to find a documentation about the class and how it works,
any help and link is really appreciated
Forum posts: 7
but i can't find the class CAmrToPcmDecoder, is there any document that introduce it?
i am using symbian 7.0s sdk2.1.
wait for you reply, thank you!
Forum posts: 29
to work on it in 2.1 sdk, it's enough to copy the amrcodec.h from sdk 1.2 to 2.1 and the dll of cource amrdll.lib,
but i must warn you, there is a huge lack of documentation about the class
Forum posts: 9
Hmm, I'm using CPcmToAmrDecoder in same way and have no prolems with thread's heap. Maybe, you're using incorrect amrdll library?
Forum posts: 127
You can use the following way to convert amr to pcm. It works perfectly.
const TInt KPcmBufferSize = 320;
const TInt KAmrBufferSize = 32;
void ConstractL()
{
iPcm16Buffer = CMMFDescriptorBuffer::NewL(KPcmBufferSize);
iAmrBuffer = CMMFDescriptorBuffer::NewL(KAmrBufferSize);
}
void CStreamPlayEngine::ConvertAmr2PcmL(const TDesC8& aAmrData,TDes8& aDestBuffer)
{
iAmrBuffer->Data().Copy(aAmrData);
TBool OkMai(EFalse);
TCodecProcessResult result = iOCodec->ProcessL(*iAmrBuffer,*iPcm16Buffer);
if((result.iStatus == TCodecProcessResult::EProcessComplete))
{
OkMai = ETrue;
aDestBuffer.Copy(iPcm16Buffer->Data());
}
}