mfurqan777 / imsdroid

Automatically exported from code.google.com/p/imsdroid
0 stars 0 forks source link

How can change the CODEC order in the SIP #293

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Now,this CODEC order is PCMA->PCMU->...->G729 in SIP,I want change to 
G729->PCMA->PCMU, How can i do it?

Original issue reported on code.google.com by LiuGeniu...@gmail.com on 27 Sep 2011 at 9:52

GoogleCodeExporter commented 9 years ago
You should look at setCodecPriority().  The thing is that it works on 
"registered" codecs, so you will want to set the codecs, then set the priority, 
then reset the codecs.

final int media_codecs = 
mConfigurationService.getInt(NgnConfigurationEntry.MEDIA_CODECS, 
                NgnConfigurationEntry.DEFAULT_MEDIA_CODECS);
int priority = 0;

SipStack.setCodecs_2(media_codecs);
SipStack.setCodecPriority(tdav_codec_id_t.tdav_codec_id_h264_custom, 
priority++);
SipStack.setCodecPriority(tdav_codec_id_t.tdav_codec_id_h264_bp10, priority++);
SipStack.setCodecPriority(tdav_codec_id_t.tdav_codec_id_speex_nb, priority++);
SipStack.setCodecPriority(tdav_codec_id_t.tdav_codec_id_pcma, priority++);

SipStack.setCodecs_2(0);  // work around weirdness in setCodecPriority
SipStack.setCodecs_2(media_codecs);

Original comment by gmapsv...@gmail.com on 4 Oct 2011 at 4:21

GoogleCodeExporter commented 9 years ago
OK,Many thanks.

Original comment by LiuGeniu...@gmail.com on 9 Oct 2011 at 5:23

GoogleCodeExporter commented 9 years ago
Fixed by revision 470.
You no longer need the hack and can reorder the codecs at any time after the 
NGN engine is started.
The default order is defined here:
http://code.google.com/p/imsdroid/source/browse/branches/2.0/android-ngn-stack/s
rc/org/doubango/ngn/NgnEngine.java#124

Original comment by boss...@yahoo.fr on 21 Oct 2011 at 12:19