I am trying to investigate the problem about the 523 error and the playerListener.ERROR state that often occurs after 30 seconds of call on the BlackBerry version.
I can't understand the mechanism implemented around the CMR byte. In [SendStream.java] the OutputStream.write() method creates an RtpPacket as follows:
RtpPacket packet=JOrtpFactory.instance().createRtpPacket(mFrameSize+1);
System.arraycopy(buffer, lOffset, packet.getBytes(), packet.getDataOffset()+1, mFrameSize);
//set cmr byte
packet.getBytes()[packet.getDataOffset()]=(byte)0xf0;
it adds the CMR byte to the packet payload, and sets it to a fixed value (15) which means that no mode request is present.
In [RecvStream.java] the SourceStream.read() method reads the RtpPacket skipping the CMR byte just added:
//+1 because we need to skip the CMR bytes
int datalen=packet.getRealLength()-packet.getDataOffset()-1;
System.arraycopy(packet.getBytes(),packet.getDataOffset()+1, b, offset, datalen );
Why is there a need to add a CMR byte if the audio from the microphone is in AMR format (and therefore should contain it)?
Why is this byte removed on packet reception?
Do the RtpPackets still contain a valid AMR format? I captured the AMR stream of a call between two blackberry devices via wireshark, dumped it in a file and added the AMR header, but it does not resemble the original audio conversation (it seems a random noise).