private void setCodecPriority(String codecName, short priority) { if (useCodecsPerSpeed) { prefsWrapper.setCodecPriority(codecName, bandtype, Short.toString(priority)); } else { prefsWrapper.setCodecPriority(codecName, SipConfigManager.CODEC_NB, Short.toString(priority)); prefsWrapper.setCodecPriority(codecName, SipConfigManager.CODEC_WB, Short.toString(priority)); } }
/** Initialize datas list */ private void initDatas() { if (codecsList == null) { codecsList = new ArrayList<Map<String, Object>>(); } else { codecsList.clear(); } bandtype = (String) getArguments().get(BAND_TYPE); mediatype = (Integer) getArguments().get(MEDIA_TYPE); String[] codecNames; if (mediatype == MEDIA_AUDIO) { codecNames = prefsWrapper.getCodecList(); } else { codecNames = prefsWrapper.getVideoCodecList(); } int current_prio = 130; for (String codecName : codecNames) { Log.d(THIS_FILE, "Fill codec " + codecName + " for " + bandtype); String[] codecParts = codecName.split("/"); if (codecParts.length >= 2) { HashMap<String, Object> codecInfo = new HashMap<String, Object>(); codecInfo.put(CODEC_ID, codecName); if (mediatype == MEDIA_AUDIO) { codecInfo.put( CODEC_NAME, codecParts[0] + " " + codecParts[1].substring(0, codecParts[1].length() - 3) + " kHz"); } else if (mediatype == MEDIA_VIDEO) { codecInfo.put(CODEC_NAME, codecParts[0]); } codecInfo.put( CODEC_PRIORITY, prefsWrapper.getCodecPriority(codecName, bandtype, Integer.toString(current_prio))); codecsList.add(codecInfo); current_prio--; Log.d(THIS_FILE, "Found priority is " + codecInfo.get(CODEC_PRIORITY)); } } Collections.sort(codecsList, codecsComparator); }