[pjsip] Adding "new" codecs?

Nanang Izzuddin nanang at pjsip.org
Fri Apr 18 03:09:00 EDT 2008

Hi Markus,

As you want it to be implemented as new codec by copying speex wrapper
files, all you need to modify are those copied files (e.g: different
API/function names, payload type, etc) and add the codec init in the

You can put the codec init right after endpoint instantiation, for
example please see pjsua, it is in pjsua_media_subsys_init()

That's all.

As alternative, you can just make one copy of the speex wrapper (to
leave the original unchanged) for all the bitrates, since the codec
factory can handle more than one codec as long as you can
differentiate them. The current speex codec factory differentiate them
using clock rates, so there are 3 'different' codecs handled by this
factory (NB, WB, UWB).
You can try to implement the codec wrapper by changing the
differentiator (e.g: by payload type or codec name).


On 17/04/2008, Markus Vechiorno <finalpfc at hotmail.com> wrote:
> Hi all,
> I am trying to implement speex with different bitrate as different codecs.
> The reason is that I want to change between them during a call without
> having to deinitialize and initialize again the speex codec (with a new
> quality parameter).
> Benny explained me that the bitrate in speex codec depends on the  selected
> quality parameter. I made some test and I notice the the different bitrates
> I am interested in are obtained with:
>  -quality = 2   --> bitrate = 5.9 Kbps
>  -quality = 3 or 4  --> bitrate = 8 Kbps
>  -quality = 5 or 6  --> bitrate = 11 Kbps
>  -quality = 7 or 8  --> bitrate = 15 Kbps
>  -quality = 9  --> bitrate = 18.2 Kbps
> Well, I want to implement as different codecs.
> I have read in the pjsip site the way to implement new codecs. What I am
> trying is to make 4 copies of speex_codec.c and speex_codec.h and name them
> speex_codec5_9, speex_codec_8, asn so...
> Doing some test with the original speex_codec, I noticed that puting a
> specific value (for example 2) when initializing the speex in
> pjmedia_codec_speex_init function:
>     spx_factory.speex_param[PARAM_NB].quality = quality;
> //Put 2 instead of quality on the right side of =
> then, you could have the speex codec with the bitrate desired.
> Getting to the point, which other files do I need to modify to get these
> 'new' codecs implemented? Where to call the init of each_one?
> I know it is not clean doing that, but I need to do it.
> Thanks a lot!!!!!!!
> ________________________________
> Sigue de cerca las últimas tendencias y lo que más rompe MSN Vídeo
> _______________________________________________
>  Visit our blog: http://blog.pjsip.org
>  pjsip mailing list
>  pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

More information about the pjsip mailing list