From 039a3cf42d1b1557f5ce5e1ea031aab8aa8bd661 Mon Sep 17 00:00:00 2001 From: Alexandre Lision <alexandre.lision@savoirfairelinux.com> Date: Wed, 16 Oct 2013 17:44:57 -0400 Subject: [PATCH] * #31884: working codec reordering --- src/org/sflphone/service/SipService.java | 33 ++++++++++++++++++------ 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/src/org/sflphone/service/SipService.java b/src/org/sflphone/service/SipService.java index 6115dfb49..eae66ee3d 100644 --- a/src/org/sflphone/service/SipService.java +++ b/src/org/sflphone/service/SipService.java @@ -1041,22 +1041,39 @@ public class SipService extends Service { Log.i(TAG, "SipService.getAudioCodecList() thread running..."); ArrayList<Codec> results = new ArrayList<Codec>(); - IntVect payloads = configurationManagerJNI.getAudioCodecList(); + IntVect active_payloads = configurationManagerJNI.getActiveAudioCodecList(accountID); + for (int i = 0; i < active_payloads.size(); ++i) { - for (int i = 0; i < payloads.size(); ++i) { - results.add(new Codec(payloads.get(i), configurationManagerJNI.getAudioCodecDetails(payloads.get(i)), false)); + results.add(new Codec(active_payloads.get(i), configurationManagerJNI.getAudioCodecDetails(active_payloads.get(i)), true)); + + if (results.get(i).getName().length() == 0) + results.remove(i); } + // if (results.get(active_payloads.get(i)) != null) { + // results.get(active_payloads.get(i)).setEnabled(true); - IntVect active_payloads = configurationManagerJNI.getActiveAudioCodecList(accountID); - for (int i = 0; i < active_payloads.size(); ++i) { + IntVect payloads = configurationManagerJNI.getAudioCodecList(); + + for (int i = 0; i < payloads.size(); ++i) { + boolean isActive = false; + for (Codec co : results) { + if (co.getPayload().toString().contentEquals(String.valueOf(payloads.get(i)))) + isActive = true; - for(Codec co : results){ - if(co.getPayload().toString().contentEquals(String.valueOf(active_payloads.get(i)))) - co.setEnabled(true); } + if (isActive) + continue; + else + results.add(new Codec(payloads.get(i), configurationManagerJNI.getAudioCodecDetails(payloads.get(i)), false)); + } + // if (!results.containsKey(payloads.get(i))) { + // results.put(payloads.get(i), new Codec(payloads.get(i), configurationManagerJNI.getAudioCodecDetails(payloads.get(i)), false)); + // Log.i(TAG, "Other, Adding:" + results.get((payloads.get(i))).getName()); + // } + return results; } } -- GitLab