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.
Both constants are defined as
// raw buffer size
#define KPcmBufferSize 320
// amr frame size
#define KAmrFrameSize 13
So the ratio 320:13 is ok, using 32 bytes buffer only waste 19 bytes Are you sure that you use the correct codec uid for converting from amr to pcm??
#define KAdvancedUidCodecAMRToPCM16 0x101FAF67
If you have still problems put your amr2pcm16 code here, so i should look on it