SIP How to change audio codec

I am new to this field ... I need to create a SIP client for android ... I am piling a demo on the developer site and I created some kind of application that works. Now I need to find a way to change the audio codec ... The default codec is g711 ... how can I change it ??? Can you provide some instruction, code or tutorial ??? Any help is appreciated ... Thanks in advance ... In this class I can't find anything to help me:


source to share

2 answers

G711 is actually a different name for the PCM codec, which has 2 compression algorithms (with the same compression rate) known as PCMA and PCMU. These are the most standard and widely used audio codecs, supported ready-to-use from almost any Sip server. They are pretty old and don't offer good compression compared to Speex, for example.

Audio codecs in SIP communications are negotiated in INVITE messages via SDP. Changing the audio codec requires the following steps:

Have an audio codec implementation.

Include (at the application level) this codec in your sip client. High-level speech - you have a network layer (most likely UDP) than a data layer (where you process RTP packets) and SIP messages.

You need a mechanism for connecting RTP packets to the audio codec that you would like to use. On the other hand, you need to use SDP to negotiate audio codecs with all parties.

There are several examples: imsdroid, csipsimple, sipdroid, etc., but they use external sip stack implementations (doubango, mjsip). AFAIK Android sip-stack is not very versatile yet.



Perhaps you could use the SIP related APIs: contains the AudioStream, AudioGroup and AudioCodec classes which are easy to use. The last one allows you to choose the codec you want.

Caveat: They were only introduced after Honeycomb, so if you are using it, you can only use devices that have this version installed or later. Considering you're already using (Gingerbread onwards) this shouldn't be a big problem.



All Articles