我试图更改在pjsip Android中使用的编解码器的优先级。我能够获取编解码器的优先级,但是在更改编解码器的优先级后,没有反映回来。
如何解决这个问题?
if( ep != null)
{
try {
CodecInfoVector codecInfoVector = ep.codecEnum();
if(!codecInfoVector.isEmpty()){
System.out.println("Codecs Enabled!!");
System.out.println("Number of codecs enabled now: "+codecInfoVector.size());
for(int i=0;i<codecInfoVector.size();i++)
{
CodecInfo codecInfo = codecInfoVector.get(i);
String codecId = codecInfo.getCodecId();
short codecPriority = 128;//use higher number for making preferred codec first.
short disableCodecPriority = 0;//use 0 to disable codec in sdp
System.out.println("Codec info now is: "+ codecId);
switch(codecId)
{
case "PCMA/8000/1":
if(Dialer_Properties.enablePCMA)
codecInfo.codecSetPriority("PCMA/8000",codecPriority);
else
codecInfo.codecSetPriority("PCMA/8000",disableCodecPriority);
break;
case "PCMU/8000/1":
if(Dialer_Properties.enablePCMU)
codecInfo.codecSetPriority("PCMU/8000",codecPriority);
else
codecInfo.codecSetPriority("PCMU/8000",disableCodecPriority);
break;
case "G729/8000/1":
if(Dialer_Properties.enableG729)
codecInfo.codecSetPriority("G729/8000",codecPriority);
else
codecInfo.codecSetPriority("G729/8000",disableCodecPriority);
break;
}
System.out.println("Codec Priority now is: "+codecInfo.getPriority());
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
如何解决这个问题?