Improves the CPU utilization and the garbage collection profile of AudioMixer. Uses the default complexity value of the native Opus library in the encoder (unless the user has explicitly specified a value, of course).

cusax-fix 4984
Lyubomir Marinov 12 years ago
parent a3d0a98fe8
commit 8d83cfb5be

@ -71,11 +71,11 @@ public class OpusConfigForm
/**
* The index of the default value for the 'complexity' setting. Index 0
* corresponds to complexity 10.
* corresponds to the default complexity set by the opus_encoder_create
* function/method.
*/
private static final int COMPLEXITY_DEFAULT_INDEX = 0;
/**
* The "audio bandwidth" combobox
*/
@ -214,12 +214,16 @@ public void focusLost(FocusEvent focusEvent) {
//Complexity
labelPanel.add(new JLabel(Resources.getString(
"plugin.generalconfig.OPUS_COMPLEXITY")));
/*
* Unless the user explicitly assigns a complexity value, let the
* opus_encoder_create function/method set the default complexity.
*/
complexityCombobox.addItem("");
for(int i = 10; i > 0; i--)
complexityCombobox.addItem(((Integer)i).toString());
complexityCombobox.addItem(Integer.toString(i));
complexityCombobox.addActionListener(this);
valuePanel.add(complexityCombobox);
restoreButton.addActionListener(this);
southPanel.add(restoreButton);
}
@ -251,9 +255,7 @@ private void restoreDefaults()
MIN_EXPECTED_PL_DEFAULT);
complexityCombobox.setSelectedIndex(COMPLEXITY_DEFAULT_INDEX);
configurationService.setProperty(
Constants.PROP_OPUS_COMPLEXITY,
complexityCombobox.getItemAt(COMPLEXITY_DEFAULT_INDEX));
configurationService.removeProperty(Constants.PROP_OPUS_COMPLEXITY);
}
/**
@ -286,9 +288,21 @@ else if(source == fecCheckbox)
}
else if(source == complexityCombobox)
{
configurationService.setProperty(
Constants.PROP_OPUS_COMPLEXITY,
complexityCombobox.getSelectedItem());
Object selectedItem = complexityCombobox.getSelectedItem();
String complexity
= (selectedItem == null) ? null : selectedItem.toString();
if ((complexity == null) || (complexity.length() == 0))
{
configurationService.removeProperty(
Constants.PROP_OPUS_COMPLEXITY);
}
else
{
configurationService.setProperty(
Constants.PROP_OPUS_COMPLEXITY,
complexity);
}
}
}
@ -311,4 +325,4 @@ private int getBandwidthIndex(String bandwidthShortName)
return i;
return -1;
}
}
}

Loading…
Cancel
Save