Adds FEC support for the SILK codec. Minor clean-ups in EncodingConfiguration and MediaConfigurationImpl.

cusax-fix
Boris Grozev 13 years ago
parent 4247259805
commit 19d2276dd4

@ -885,6 +885,17 @@ plugin.generalconfig.REMOVE_SPECIAL_PHONE_SYMBOLS=Remove special symbols before
plugin.generalconfig.ACCEPT_PHONE_NUMBER_WITH_ALPHA_CHARS=Convert letters in phone numbers
plugin.generalconfig.ACCEPT_PHONE_NUMBER_WITH_ALPHA_CHARS_EXAMPLE=e.g. +1-800-MYPHONE -> +1-800-694663
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_USE_DTX=Use DTX:
plugin.generalconfig.OPUS_USE_CBR=Use CBR:
plugin.generalconfig.OPUS_USE_FEC=Use inband FEC:
plugin.generalconfig.SILK_CONFIG=Silk
plugin.generalconfig.SILK_USE_FEC=Use inband FEC:
plugin.generalconfig.SILK_FORCE_FEC_PACKET_LOSS=Force the encoder to expect packet loss:
plugin.generalconfig.SILK_SAT=Speech activity threshold (0-1):
plugin.generalconfig.RESTORE=Restore defaults
# gibberish accregwizz
plugin.gibberishaccregwizz.PROTOCOL_NAME=Gibberish

@ -581,6 +581,7 @@ public void run()
/**
* Creates all the controls (including encoding) for a type(AUDIO or VIDEO)
*
* @param type the type.
* @return the build Component.
*/
@ -627,8 +628,12 @@ private Component createControls(int type)
/**
* Returns a component for encodings configuration for the given
* <tt>mediaType</tt>
*
* @param mediaType Either <tt>MediaType.AUDIO</tt> or
* <tt>MediaType.VIDEO</tt>
* @param encodingConfiguration The <tt>EncodingConfiguration</tt> instance
* to use. If null, it will use the current encoding configuration from
* the media service.
* @return The component for encodings configuration.
*/
public Component createEncodingControls(
@ -665,7 +670,12 @@ public Component createEncodingControls(
/**
* Creates Component for the encodings of type(AUDIO or VIDEO).
* @param type the type
*
* @param type the type, either DeviceConfigurationComboBoxModel.AUDIO or
* DeviceConfigurationComboBoxModel.AUDIO
* @param encodingConfiguration The <tt>EncodingConfiguration</tt> instance
* to use. If null, it will use the current encoding configuration from
* the media service.
* @return the component.
*/
private Component createEncodingControls(int type,
@ -946,6 +956,7 @@ private static String getLabelText(int type)
/**
* Used to move encoding options.
*
* @param table the table with encodings
* @param up move direction.
*/

@ -145,6 +145,17 @@ public void start(BundleContext bc)
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

@ -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);
}
}
Loading…
Cancel
Save