aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/plugin
diff options
context:
space:
mode:
authorBoris Grozev <boris@jitsi.org>2012-10-05 11:58:37 +0000
committerBoris Grozev <boris@jitsi.org>2012-10-05 11:58:37 +0000
commit19d2276dd4ff5e3458b9aafd876aa38391feeac5 (patch)
tree414285d3de7fb0495e4590a846576e1d4044be54 /src/net/java/sip/communicator/plugin
parent4247259805b7abf2d575185b69bc3de46a0b7dcf (diff)
downloadjitsi-19d2276dd4ff5e3458b9aafd876aa38391feeac5.zip
jitsi-19d2276dd4ff5e3458b9aafd876aa38391feeac5.tar.gz
jitsi-19d2276dd4ff5e3458b9aafd876aa38391feeac5.tar.bz2
Adds FEC support for the SILK codec. Minor clean-ups in EncodingConfiguration and MediaConfigurationImpl.
Diffstat (limited to 'src/net/java/sip/communicator/plugin')
-rw-r--r--src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java11
-rw-r--r--src/net/java/sip/communicator/plugin/generalconfig/SilkConfigForm.java189
2 files changed, 200 insertions, 0 deletions
diff --git a/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java b/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java
index ca7b592..2767400 100644
--- a/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java
+++ b/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java
@@ -145,6 +145,17 @@ public class GeneralConfigPluginActivator
52, true),
properties);
}
+ properties.put( ConfigurationForm.FORM_TYPE,
+ ConfigurationForm.ADVANCED_TYPE);
+ bundleContext.registerService(
+ ConfigurationForm.class.getName(),
+ new LazyConfigurationForm(
+ SilkConfigForm.class.getName(),
+ getClass().getClassLoader(),
+ null,
+ "plugin.generalconfig.SILK_CONFIG",
+ 52, true),
+ properties);
/*
* Wait for the first ProtocolProviderService to register in order to
diff --git a/src/net/java/sip/communicator/plugin/generalconfig/SilkConfigForm.java b/src/net/java/sip/communicator/plugin/generalconfig/SilkConfigForm.java
new file mode 100644
index 0000000..5ebac66
--- /dev/null
+++ b/src/net/java/sip/communicator/plugin/generalconfig/SilkConfigForm.java
@@ -0,0 +1,189 @@
+/*
+ * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.plugin.generalconfig;
+
+
+import net.java.sip.communicator.util.swing.*;
+import org.jitsi.service.configuration.ConfigurationService;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+
+
+/**
+ * Implements the Silk configuration panel.
+ *
+ * @author Boris Grozev
+ */
+public class SilkConfigForm
+ extends TransparentPanel
+{
+ /**
+ * The property name associated with the 'use fec' setting
+ */
+ private static final String FEC_PROP
+ = "net.java.sip.communicator.impl.neomedia.codec.audio.silk." +
+ "encoder.usefec";
+
+ /**
+ * The property name associated with the 'force packet loss' setting
+ */
+ private static final String FEC_FORCE_PL_PROP
+ = "net.java.sip.communicator.impl.neomedia.codec.audio.silk." +
+ "encoder.forcepacketloss";
+
+ /**
+ * The property name associated with the 'speech activity threshold' setting
+ */
+ private static final String FEC_SAT_PROP
+ = "net.java.sip.communicator.impl.neomedia.codec.audio.silk." +
+ "encoder.sat";
+
+ /**
+ * The default value for the SAT setting
+ */
+ private static final String FEC_SAT_DEFAULT = "0.5";
+
+ /**
+ * The default value for the FEC setting
+ */
+ private static final boolean FEC_DEFAULT = true;
+
+ /**
+ * The default value for the FEC force packet loss setting
+ */
+ private static final boolean FEC_FORCE_PL_DEFAULT = true;
+
+ /**
+ * The "restore defaults" button
+ */
+ private final JButton restoreButton = new JButton(Resources.getString(
+ "plugin.generalconfig.RESTORE"));
+
+ /**
+ * The "use fec" checkbox
+ */
+ private final JCheckBox fecCheckbox = new JCheckBox();
+
+ /**
+ * The "force packet loss" checkbox
+ */
+ private final JCheckBox fecForcePLCheckbox = new JCheckBox();
+
+ /**
+ * The "speech activity threshold" field
+ */
+ private final JTextField SATField = new JTextField(6);
+
+ /**
+ * The <tt>ConfigurationService</tt> to be used to access configuration
+ */
+ ConfigurationService configurationService
+ = GeneralConfigPluginActivator.getConfigurationService();
+
+
+ /**
+ * Initialize a new <tt>OpusConfigForm</tt> instance.
+ */
+ public SilkConfigForm()
+ {
+ super(new BorderLayout());
+ Box box = Box.createVerticalBox();
+ add(box, BorderLayout.NORTH);
+
+ TransparentPanel contentPanel = new TransparentPanel();
+ contentPanel.setLayout(new BorderLayout(10, 10));
+
+ box.add(contentPanel);
+
+ TransparentPanel labelPanel
+ = new TransparentPanel(new GridLayout(0, 1, 2, 2));
+ TransparentPanel valuePanel
+ = new TransparentPanel(new GridLayout(0, 1, 2, 2));
+ TransparentPanel southPanel
+ = new TransparentPanel(new GridLayout(0, 1, 2, 2));
+
+ contentPanel.add(labelPanel, BorderLayout.WEST);
+ contentPanel.add(valuePanel, BorderLayout.CENTER);
+ contentPanel.add(southPanel, BorderLayout.SOUTH);
+
+ labelPanel.add(new JLabel(Resources.getString(
+ "plugin.generalconfig.SILK_USE_FEC")));
+ labelPanel.add(new JLabel(Resources.getString(
+ "plugin.generalconfig.SILK_FORCE_FEC_PACKET_LOSS")));
+ labelPanel.add(new JLabel(Resources.getString(
+ "plugin.generalconfig.SILK_SAT")));
+
+
+ fecCheckbox.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent) {
+ configurationService.setProperty(FEC_PROP,
+ fecCheckbox.isSelected());
+ }
+ });
+ fecCheckbox.setSelected(configurationService.getBoolean(
+ FEC_PROP, FEC_DEFAULT));
+ valuePanel.add(fecCheckbox);
+
+ fecForcePLCheckbox.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent) {
+ configurationService.setProperty(FEC_PROP,
+ fecForcePLCheckbox.isSelected());
+ }
+ });
+ fecForcePLCheckbox.setSelected(configurationService.getBoolean(
+ FEC_FORCE_PL_PROP, FEC_FORCE_PL_DEFAULT));
+ valuePanel.add(fecForcePLCheckbox);
+
+ SATField.addFocusListener(new FocusListener() {
+ @Override
+ public void focusGained(FocusEvent focusEvent){}
+
+ @Override
+ public void focusLost(FocusEvent focusEvent)
+ {
+ configurationService.setProperty(FEC_SAT_PROP,
+ SATField.getText());
+ }
+ });
+ SATField.setText(configurationService.getString(
+ FEC_SAT_PROP, FEC_SAT_DEFAULT));
+ valuePanel.add(SATField);
+
+
+ southPanel.add(restoreButton);
+ restoreButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e)
+ {
+ restoreDefaults();
+ }
+ });
+
+ }
+
+ /**
+ * Restores the UI components and the configuration to their default state
+ */
+ private void restoreDefaults()
+ {
+ fecCheckbox.setSelected(FEC_DEFAULT);
+ configurationService.setProperty(FEC_PROP, FEC_DEFAULT);
+
+ fecForcePLCheckbox.setSelected(FEC_FORCE_PL_DEFAULT);
+ configurationService.setProperty(
+ FEC_FORCE_PL_PROP, FEC_FORCE_PL_DEFAULT);
+
+ SATField.setText(FEC_SAT_DEFAULT);
+ configurationService.setProperty(FEC_SAT_PROP, FEC_SAT_DEFAULT);
+ }
+} \ No newline at end of file