Fixes multiple issues related to unplugging the last audio device and then plugging it back.

cusax-fix
Lyubomir Marinov 13 years ago
parent d9a8f104aa
commit 72c288d252

@ -43,7 +43,7 @@ net.java.sip.communicator.util.FileHandler.level = INFO
# Limit the message that are printed on the console to FINEST and above (all).
java.util.logging.ConsoleHandler.level = SEVERE
java.util.logging.ConsoleHandler.level = FINEST
java.util.logging.ConsoleHandler.formatter = net.java.sip.communicator.util.ScLogFormatter
@ -59,6 +59,7 @@ net.kano.level = INFO
net.sf.cindy.impl.level = INFO
# But we want everything coming from the sip-comm
org.jitsi.impl.neomedia.level = FINEST
# For example, set the com.xyz.foo logger to only log SEVERE
# messages:

@ -72,7 +72,7 @@ public void propertyChange(PropertyChangeEvent ev)
* The list of available capture, notification and/or playback devices
* has changes.
*/
if(DeviceConfiguration.PROP_AUDIO_SYSTEM_DEVICES.equals(propertyName))
if (DeviceConfiguration.PROP_AUDIO_SYSTEM_DEVICES.equals(propertyName))
{
@SuppressWarnings("unchecked")
List<CaptureDeviceInfo> oldDevices

@ -145,11 +145,7 @@ private AudioSystem[] getAudioSystems()
if (type != AUDIO)
throw new IllegalStateException("type");
// This must updated at each call to allows hotplug device system to be
// enabled (if the number of devices change to someting greater than 0)
// or disabled (if the number of available device changes to 0).
audioSystems = deviceConfiguration.getAvailableAudioSystems();
return audioSystems;
}
@ -288,11 +284,12 @@ public int getSize()
*/
public void propertyChange(final PropertyChangeEvent ev)
{
if(DeviceConfiguration.PROP_AUDIO_SYSTEM_DEVICES.equals(
if (DeviceConfiguration.PROP_AUDIO_SYSTEM_DEVICES.equals(
ev.getPropertyName()))
{
if(SwingUtilities.isEventDispatchThread())
if (SwingUtilities.isEventDispatchThread())
{
audioSystems = null;
devices = null;
fireContentsChanged(0, getSize() - 1);
}

@ -445,13 +445,6 @@ else if(value instanceof Dimension)
}
}
/**
* The name of the property which specifies if the audio system interface
* is disabled.
*/
private static final String AUDIO_SYSTEM_DISABLED_PROP
= "net.java.sip.communicator.impl.neomedia.audiosystem.DISABLED";
/**
* Indicates if the Devices settings configuration tab
* should be disabled, i.e. not visible to the user.
@ -1138,7 +1131,7 @@ private Component createBasicControls(final int type)
final boolean isAudioSystemComboDisabled
= (type == DeviceConfigurationComboBoxModel.AUDIO)
&& NeomediaActivator.getConfigurationService().getBoolean(
AUDIO_SYSTEM_DISABLED_PROP,
MediaServiceImpl.DISABLE_SET_AUDIO_SYSTEM_PNAME,
false);
// For audio configuration form first check if the audio system
@ -1296,16 +1289,16 @@ private Component createControls(int type)
compCount++;
devicesComponent = createBasicControls(type);
}
if (cfg == null || !cfg.getBoolean(ENCODINGS_DISABLED_PROP, false))
{
compCount++;
encodingsComponent = createEncodingControls(type, null);
}
if (type == DeviceConfigurationComboBoxModel.VIDEO
&& (cfg == null
|| !cfg.getBoolean(VIDEO_MORE_SETTINGS_DISABLED_PROP, false)))
if ((type == DeviceConfigurationComboBoxModel.VIDEO)
&& ((cfg == null)
|| !cfg.getBoolean(
VIDEO_MORE_SETTINGS_DISABLED_PROP,
false)))
{
compCount++;
videoComponent = createVideoAdvancedSettings();
@ -1314,8 +1307,8 @@ private Component createControls(int type)
ResourceManagementService res = NeomediaActivator.getResources();
Container container;
// If we only have one configuration form we don't need to create
// a tabbed pane.
// If we only have one configuration form we don't need to create a
// tabbed pane.
if (compCount < 2)
{
container = new TransparentPanel(new BorderLayout());
@ -1332,46 +1325,40 @@ else if (videoComponent != null)
container = new SIPCommTabbedPane();
SIPCommTabbedPane tabbedPane = (SIPCommTabbedPane) container;
int index = 0;
if (devicesComponent != null)
{
tabbedPane.insertTab(
res.getI18NString("impl.media.configform.DEVICES"),
null,
devicesComponent,
null,
index);
res.getI18NString("impl.media.configform.DEVICES"),
null,
devicesComponent,
null,
index);
index = 1;
}
if (encodingsComponent != null)
{
if (tabbedPane.getTabCount() >= 1)
index = 1;
tabbedPane.insertTab(
res.getI18NString("impl.media.configform.ENCODINGS"),
null,
encodingsComponent,
null,
index);
res.getI18NString("impl.media.configform.ENCODINGS"),
null,
encodingsComponent,
null,
index);
}
if (videoComponent != null)
{
if (tabbedPane.getTabCount() >= 2)
index = 2;
tabbedPane.insertTab(
res.getI18NString(
"impl.media.configform.VIDEO_MORE_SETTINGS"),
null,
videoComponent,
null,
index);
res.getI18NString(
"impl.media.configform.VIDEO_MORE_SETTINGS"),
null,
videoComponent,
null,
index);
}
}
@ -1575,12 +1562,11 @@ private Component createPreview(
{
AudioSystem audioSystem = null;
// If the Audio System combo box is disabled we're looking for the
// If the Audio System combo box is disabled, we're looking for the
// default device configuration.
if (NeomediaActivator.getConfigurationService()
.getBoolean(AUDIO_SYSTEM_DISABLED_PROP, false)
&& mediaService.getDeviceConfiguration().getAudioSystem()
!= null)
if (NeomediaActivator.getConfigurationService().getBoolean(
MediaServiceImpl.DISABLE_SET_AUDIO_SYSTEM_PNAME,
false))
{
audioSystem
= mediaService.getDeviceConfiguration().getAudioSystem();
@ -1593,34 +1579,39 @@ private Component createPreview(
audioSystem = (AudioSystem) selectedItem;
}
if (audioSystem != null
&& !NoneAudioSystem.LOCATOR_PROTOCOL.equalsIgnoreCase(
audioSystem.getLocatorProtocol()))
if ((audioSystem != null)
&& !NoneAudioSystem.LOCATOR_PROTOCOL.equalsIgnoreCase(
audioSystem.getLocatorProtocol()))
{
preview = new TransparentPanel(new GridBagLayout());
createAudioSystemControls(audioSystem, preview);
}
else
{
AudioSystem[] availableAudioSystems
= AudioSystem.getAudioSystems();
AudioSystem[] activeAudioSystems = mediaService
.getDeviceConfiguration().getAvailableAudioSystems();
// If the only one active audio system which is "None" and there
// is(are) other(s) available audio system(s), then it means
// that the other(s) audio system(s) do(es) not have detected
// any device.
if(availableAudioSystems != null
&& availableAudioSystems.length > 1
&& activeAudioSystems != null
&& activeAudioSystems.length == 1)
/*
* If there are AudioSystems other than "None" and they have all
* not been reported as available, then each of them failed to
* detect any devices whatsoever.
*/
AudioSystem[] audioSystems = AudioSystem.getAudioSystems();
if ((audioSystems != null) && (audioSystems.length != 1))
{
String noAvailableAudioDevice
= NeomediaActivator.getResources().getI18NString(
"impl.media.configform.NO_AVAILABLE_AUDIO_DEVICE");
preview = new TransparentPanel(new GridBagLayout());
preview.add(new JLabel(noAvailableAudioDevice));
AudioSystem[] availableAudioSystems
= mediaService
.getDeviceConfiguration()
.getAvailableAudioSystems();
if ((availableAudioSystems != null)
&& (availableAudioSystems.length == 1))
{
String noAvailableAudioDevice
= NeomediaActivator.getResources().getI18NString(
"impl.media.configform.NO_AVAILABLE_AUDIO_DEVICE");
preview = new TransparentPanel(new GridBagLayout());
preview.add(new JLabel(noAvailableAudioDevice));
}
}
}
}

Loading…
Cancel
Save