PCM to AMR conversion problem
I am working on audio streaming for Nokia 6630 in Symbian 8.0. I am trying to convert the PCM samples to AMR using the following code:
// Uid of PCM16toAMR codec is 0x101FAF68
CMMFCodec* codec = CMMFCodec::NewL(TUid::Uid(0x101FAF68));
CMMFDescriptorBuffer* srcbuf = CMMFDescriptorBuffer::NewL(320);
CMMFDescriptorBuffer* dstbuf = CMMFDescriptorBuffer::NewL(32);
srcbuf->Data().Copy(*iStreamBuffer[iStreamIdx]); //Copy your PCM frame data into srcbuf, for example:
result = codec->ProcessL(*srcbuf, *dstbuf);
(*iEncBuffer[iStreamIdx]).Copy(dstbuf->Data()); //Copy the AMR data into the buffer
Again AMR to PCM conversion i use the same code with UID 0x101FAF67.
I give 320 bytes of PCM sample for conversion but I get only 13 bytes encoded AMR data. Again when I pass this 13 bytes, the AMR to PCM conversion gives 32 bytes which i feel it is wrong. When I play these samples i get a garbage sound. Can anyone tell me where I went wrong? Help needed urgently over this...
I want to know what AMR encoding rate is used.