diff --git a/lib/installer-exclude/libjitsi.jar b/lib/installer-exclude/libjitsi.jar index 7bb2c490a..05f065b18 100644 Binary files a/lib/installer-exclude/libjitsi.jar and b/lib/installer-exclude/libjitsi.jar differ diff --git a/lib/native/linux-64/libjnopus.so b/lib/native/linux-64/libjnopus.so index 5a73eaafb..045fa4c93 100755 Binary files a/lib/native/linux-64/libjnopus.so and b/lib/native/linux-64/libjnopus.so differ diff --git a/lib/native/linux/libjnopus.so b/lib/native/linux/libjnopus.so index c55810f14..6fa870980 100755 Binary files a/lib/native/linux/libjnopus.so and b/lib/native/linux/libjnopus.so differ diff --git a/lib/native/mac/libjnopus.jnilib b/lib/native/mac/libjnopus.jnilib deleted file mode 100755 index 7b58804f5..000000000 Binary files a/lib/native/mac/libjnopus.jnilib and /dev/null differ diff --git a/lib/native/windows-64/jnopus.dll b/lib/native/windows-64/jnopus.dll index 02ddb34c3..903c58208 100755 Binary files a/lib/native/windows-64/jnopus.dll and b/lib/native/windows-64/jnopus.dll differ diff --git a/lib/native/windows/jnopus.dll b/lib/native/windows/jnopus.dll index 961fb5be4..4e4e6d8f5 100755 Binary files a/lib/native/windows/jnopus.dll and b/lib/native/windows/jnopus.dll differ diff --git a/resources/languages/resources.properties b/resources/languages/resources.properties index 54b393ab9..5073f6d78 100644 --- a/resources/languages/resources.properties +++ b/resources/languages/resources.properties @@ -896,10 +896,11 @@ plugin.generalconfig.ACCEPT_PHONE_NUMBER_WITH_ALPHA_CHARS_EXAMPLE=e.g. +1-800-MY plugin.generalconfig.SIP_CALL_CONFIG=SIP plugin.generalconfig.OPUS_CONFIG=Opus plugin.generalconfig.OPUS_AUDIO_BANDWIDTH=Audio bandwidth: -plugin.generalconfig.OPUS_BITRATE=Maximun average bitrate: +plugin.generalconfig.OPUS_BITRATE=Encoder average bitrate (kbps): plugin.generalconfig.OPUS_USE_DTX=Use DTX: -plugin.generalconfig.OPUS_USE_CBR=Use CBR: plugin.generalconfig.OPUS_USE_FEC=Use inband FEC: +plugin.generalconfig.OPUS_COMPLEXITY=Encoder complexity: +plugin.generalconfig.OPUS_MIN_EXPECTED_PACKET_LOSS=Minimum expected packet loss(%): plugin.generalconfig.SILK_CONFIG=Silk plugin.generalconfig.SILK_USE_FEC=Use inband FEC: plugin.generalconfig.SILK_ALWAYS_ASSUME_PACKET_LOSS=Always assume packet loss: diff --git a/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java b/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java index 27674005f..0d9ce87d1 100644 --- a/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java +++ b/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java @@ -154,7 +154,16 @@ public void start(BundleContext bc) getClass().getClassLoader(), null, "plugin.generalconfig.SILK_CONFIG", - 52, true), + 0, true), + properties); + bundleContext.registerService( + ConfigurationForm.class.getName(), + new LazyConfigurationForm( + OpusConfigForm.class.getName(), + getClass().getClassLoader(), + null, + "plugin.generalconfig.OPUS_CONFIG", + 0, true), properties); /* diff --git a/src/net/java/sip/communicator/plugin/generalconfig/OpusConfigForm.java b/src/net/java/sip/communicator/plugin/generalconfig/OpusConfigForm.java new file mode 100644 index 000000000..0f7005fd7 --- /dev/null +++ b/src/net/java/sip/communicator/plugin/generalconfig/OpusConfigForm.java @@ -0,0 +1,316 @@ +/* + * 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.*; +import org.jitsi.service.neomedia.codec.*; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; + +/** + * Implements the Opus configuration panel. + * + * @author Boris Grozev + */ +public class OpusConfigForm + extends TransparentPanel + implements ActionListener +{ + /** + * Strings for audio bandwidths. Used as the value for the bandwidth + * property. In sync with BANDWIDTHS_LONG + */ + private static final String[] BANDWIDTHS = new String[]{ + "auto", "fb", "swb", "wb", "mb", "nb" + }; + + /** + * The strings used in the combobox. In sync with BANDWIDTHS + */ + private static final String[] BANDWIDTHS_LONG = new String[]{ + "Auto", + "Fullband (48kHz)", + "Super-wideband (24kHz)", + "Wideband (16kHz)", + "Medium-band (12kHz)", + "Narrowband (8kHz)" + }; + + /** + * The default value for the "bandwidth" setting. + */ + private static final String BANDWIDTH_DEFAULT = "auto"; + + /** + * The default value for the "bitrate" setting + */ + private static final int BITRATE_DEFAULT = 32; + + /** + * The default value for the "dtx" setting + */ + private static final boolean DTX_DEFAULT = true; + + /** + * The default value for the "fec" setting + */ + private static final boolean FEC_DEFAULT = true; + + /** + * The default value for the "minimum expected packet loss" setting + */ + private static final int MIN_EXPECTED_PL_DEFAULT = 1; + + /** + * The index of the default value for the 'complexity' setting. Index 0 + * corresponds to complexity 10. + */ + private static final int COMPLEXITY_DEFAULT_INDEX = 0; + + + /** + * The "audio bandwidth" combobox + */ + private final JComboBox bandwidthCombobox = new JComboBox(); + + /** + * The "bitrate" field + */ + private final JTextField bitrateField = new JTextField(6); + + /** + * The "use dtx" checkbox + */ + private final JCheckBox dtxCheckbox = new JCheckBox(); + + /** + * The "use fec" checkbox + */ + private final JCheckBox fecCheckbox = new JCheckBox(); + + /** + * The "minimum expected packet loss" field + */ + private final JTextField minExpectedPLField = new JTextField(3); + + /** + * The "complexity" combobox + */ + private final JComboBox complexityCombobox = new JComboBox(); + + + /** + * The ConfigurationService to be used to access configuration + */ + private final ConfigurationService configurationService + = GeneralConfigPluginActivator.getConfigurationService(); + + /** + * The "restore defaults" button + */ + private final JButton restoreButton = new JButton(Resources.getString( + "plugin.generalconfig.RESTORE")); + + /** + * Initialize a new OpusConfigForm instance. + */ + public OpusConfigForm() + { + 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); + + //Audio bandwidth + labelPanel.add(new JLabel(Resources.getString( + "plugin.generalconfig.OPUS_AUDIO_BANDWIDTH"))); + for(String str : BANDWIDTHS_LONG) + bandwidthCombobox.addItem(str); + bandwidthCombobox.setSelectedIndex(getBandwidthIndex( + configurationService.getString( + Constants.PROP_OPUS_BANDWIDTH, BANDWIDTH_DEFAULT))); + bandwidthCombobox.addActionListener(this); + valuePanel.add(bandwidthCombobox); + + + //Bitrate + labelPanel.add(new JLabel(Resources.getString( + "plugin.generalconfig.OPUS_BITRATE"))); + bitrateField.setText( + ((Integer)configurationService.getInt( + Constants.PROP_OPUS_BITRATE, + BITRATE_DEFAULT)) + .toString()); + bitrateField.addFocusListener(new FocusListener() { + public void focusGained(FocusEvent focusEvent) {} + + public void focusLost(FocusEvent focusEvent) { + configurationService.setProperty( + Constants.PROP_OPUS_BITRATE, bitrateField.getText()); + } + }); + valuePanel.add(bitrateField); + + //DTX + labelPanel.add(new JLabel(Resources.getString( + "plugin.generalconfig.OPUS_USE_DTX"))); + dtxCheckbox.setSelected( + configurationService.getBoolean( + Constants.PROP_OPUS_DTX, DTX_DEFAULT)); + dtxCheckbox.addActionListener(this); + valuePanel.add(dtxCheckbox); + + //FEC + labelPanel.add(new JLabel(Resources.getString( + "plugin.generalconfig.OPUS_USE_FEC"))); + fecCheckbox.setSelected( + configurationService.getBoolean( + Constants.PROP_OPUS_FEC, FEC_DEFAULT)); + fecCheckbox.addActionListener(this); + valuePanel.add(fecCheckbox); + //Disabled until FEC actually works + fecCheckbox.setEnabled(false); + + //min expected packet loss + labelPanel.add(new JLabel(Resources.getString( + "plugin.generalconfig.OPUS_MIN_EXPECTED_PACKET_LOSS"))); + minExpectedPLField.setText( + configurationService.getString( + Constants.PROP_OPUS_MIN_EXPECTED_PACKET_LOSS, + ((Integer)MIN_EXPECTED_PL_DEFAULT).toString())); + minExpectedPLField.addFocusListener(new FocusListener() { + public void focusGained(FocusEvent focusEvent) { + } + + public void focusLost(FocusEvent focusEvent) { + configurationService.setProperty( + Constants.PROP_OPUS_MIN_EXPECTED_PACKET_LOSS, + minExpectedPLField.getText()); + } + }); + valuePanel.add(minExpectedPLField); + + //Complexity + labelPanel.add(new JLabel(Resources.getString( + "plugin.generalconfig.OPUS_COMPLEXITY"))); + for(int i = 10; i > 0; i--) + complexityCombobox.addItem(((Integer)i).toString()); + complexityCombobox.addActionListener(this); + valuePanel.add(complexityCombobox); + + + restoreButton.addActionListener(this); + southPanel.add(restoreButton); + } + + /** + * Restores the UI components to the default values and writes the default + * values to the configuration. + */ + private void restoreDefaults() + { + bandwidthCombobox.setSelectedIndex(getBandwidthIndex(BANDWIDTH_DEFAULT)); + + bitrateField.setText(((Integer)BITRATE_DEFAULT).toString()); + configurationService.setProperty( + Constants.PROP_OPUS_BITRATE, BITRATE_DEFAULT); + + dtxCheckbox.setSelected(DTX_DEFAULT); + configurationService.setProperty( + Constants.PROP_OPUS_DTX, DTX_DEFAULT); + + fecCheckbox.setSelected(FEC_DEFAULT); + configurationService.setProperty( + Constants.PROP_OPUS_FEC, FEC_DEFAULT); + + minExpectedPLField.setText( + ((Integer)MIN_EXPECTED_PL_DEFAULT).toString()); + configurationService.setProperty( + Constants.PROP_OPUS_MIN_EXPECTED_PACKET_LOSS, + MIN_EXPECTED_PL_DEFAULT); + + complexityCombobox.setSelectedIndex(COMPLEXITY_DEFAULT_INDEX); + configurationService.setProperty( + Constants.PROP_OPUS_COMPLEXITY, + complexityCombobox.getItemAt(COMPLEXITY_DEFAULT_INDEX)); + } + + /** + * Action listener for the checkboxes, buttons and comboboxes. Updates + * the configuration service with the appropriate new value. + * @param actionEvent + */ + public void actionPerformed(ActionEvent actionEvent) + { + Object source = actionEvent.getSource(); + if(source == restoreButton) + { + restoreDefaults(); + } + else if (source == bandwidthCombobox) + { + configurationService.setProperty( + Constants.PROP_OPUS_BANDWIDTH, + BANDWIDTHS[bandwidthCombobox.getSelectedIndex()]); + } + else if(source == dtxCheckbox) + { + configurationService.setProperty( + Constants.PROP_OPUS_DTX, dtxCheckbox.isSelected()); + } + else if(source == fecCheckbox) + { + configurationService.setProperty( + Constants.PROP_OPUS_FEC, fecCheckbox.isSelected()); + } + else if(source == complexityCombobox) + { + configurationService.setProperty( + Constants.PROP_OPUS_COMPLEXITY, + complexityCombobox.getSelectedItem()); + } + } + + /** + * Returns the index of the audio bandwidth with a short name + * bandwidthShortName in bandwidthCheckbox, or -1 if it's + * not found. + * + * @param bandwidthShortName the short name of the audio bandwidth to return + * to return the index of. + * + * @return the index of the audio bandwidth with a short name + * bandwidthShortName in bandwidthCheckbox, or -1 if it's + * not found. + */ + private int getBandwidthIndex(String bandwidthShortName) + { + for(int i = 0; i < BANDWIDTHS.length; i++) + if(BANDWIDTHS[i].equals(bandwidthShortName)) + return i; + return -1; + } +} \ No newline at end of file diff --git a/src/net/java/sip/communicator/plugin/generalconfig/SilkConfigForm.java b/src/net/java/sip/communicator/plugin/generalconfig/SilkConfigForm.java index d26287539..e49be87b2 100644 --- a/src/net/java/sip/communicator/plugin/generalconfig/SilkConfigForm.java +++ b/src/net/java/sip/communicator/plugin/generalconfig/SilkConfigForm.java @@ -9,6 +9,7 @@ import net.java.sip.communicator.util.swing.*; import org.jitsi.service.configuration.*; +import org.jitsi.service.neomedia.codec.*; import javax.swing.*; import java.awt.*; @@ -22,33 +23,7 @@ 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.USE_FEC"; - /** - * The property name associated with the 'always assume packet loss' setting - */ - private static final String ASSUME_PL_PROP - = "net.java.sip.communicator.impl.neomedia.codec.audio.silk." + - "encoder.AWLAYS_ASSUME_PACKET_LOSS"; - - /** - * 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.SPEECH_ACTIVITY_THRESHOLD"; - - /** - * The property name associated with the 'advertise fec' setting - */ - private static final String FEC_ADVERTISE_PROP - = "net.java.sip.communicator.impl.neomedia.codec.audio.silk." + - "ADVERTISE_FEC"; /** * The default value for the SAT setting @@ -140,22 +115,22 @@ public SilkConfigForm() fecCheckbox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { - configurationService.setProperty(FEC_PROP, + configurationService.setProperty(Constants.PROP_SILK_FEC, fecCheckbox.isSelected()); } }); fecCheckbox.setSelected(configurationService.getBoolean( - FEC_PROP, FEC_DEFAULT)); + Constants.PROP_SILK_FEC, FEC_DEFAULT)); valuePanel.add(fecCheckbox); assumePLCheckbox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { - configurationService.setProperty(ASSUME_PL_PROP, + configurationService.setProperty(Constants.PROP_SILK_ASSUME_PL, assumePLCheckbox.isSelected()); } }); assumePLCheckbox.setSelected(configurationService.getBoolean( - ASSUME_PL_PROP, FEC_FORCE_PL_DEFAULT)); + Constants.PROP_SILK_ASSUME_PL, FEC_FORCE_PL_DEFAULT)); valuePanel.add(assumePLCheckbox); SATField.addFocusListener(new FocusListener() { @@ -163,22 +138,23 @@ public void focusGained(FocusEvent focusEvent){} public void focusLost(FocusEvent focusEvent) { - configurationService.setProperty(FEC_SAT_PROP, + configurationService.setProperty(Constants.PROP_SILK_FEC_SAT, SATField.getText()); } }); SATField.setText(configurationService.getString( - FEC_SAT_PROP, FEC_SAT_DEFAULT)); + Constants.PROP_SILK_FEC_SAT, FEC_SAT_DEFAULT)); valuePanel.add(SATField); advertiseFECCheckbox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { - configurationService.setProperty(FEC_ADVERTISE_PROP, + configurationService.setProperty( + Constants.PROP_SILK_ADVERSISE_FEC, advertiseFECCheckbox.isSelected()); } }); advertiseFECCheckbox.setSelected(configurationService.getBoolean( - FEC_ADVERTISE_PROP, FEC_ADVERTISE_DEFAULT)); + Constants.PROP_SILK_ADVERSISE_FEC, FEC_ADVERTISE_DEFAULT)); valuePanel.add(advertiseFECCheckbox); @@ -199,17 +175,18 @@ public void actionPerformed(ActionEvent e) private void restoreDefaults() { fecCheckbox.setSelected(FEC_DEFAULT); - configurationService.setProperty(FEC_PROP, FEC_DEFAULT); + configurationService.setProperty(Constants.PROP_SILK_FEC, FEC_DEFAULT); assumePLCheckbox.setSelected(FEC_FORCE_PL_DEFAULT); configurationService.setProperty( - ASSUME_PL_PROP, FEC_FORCE_PL_DEFAULT); + Constants.PROP_SILK_ASSUME_PL, FEC_FORCE_PL_DEFAULT); SATField.setText(FEC_SAT_DEFAULT); - configurationService.setProperty(FEC_SAT_PROP, FEC_SAT_DEFAULT); + configurationService.setProperty( + Constants.PROP_SILK_FEC_SAT, FEC_SAT_DEFAULT); advertiseFECCheckbox.setSelected(FEC_ADVERTISE_DEFAULT); configurationService.setProperty( - FEC_ADVERTISE_PROP, FEC_ADVERTISE_DEFAULT); + Constants.PROP_SILK_ADVERSISE_FEC, FEC_ADVERTISE_DEFAULT); } } \ No newline at end of file