aboutsummaryrefslogtreecommitdiffstats
path: root/src/net
diff options
context:
space:
mode:
authorLyubomir Marinov <lyubomir.marinov@jitsi.org>2012-08-03 15:14:19 +0000
committerLyubomir Marinov <lyubomir.marinov@jitsi.org>2012-08-03 15:14:19 +0000
commit601776d42f1d226b622881b3aa40f3394ab3a97a (patch)
tree5336ba6db439bb6628e73e7174bc1d54e6fc9444 /src/net
parent9cdde989fa7b7a7aa3613cabc2a0ebdf86eb99ad (diff)
downloadjitsi-601776d42f1d226b622881b3aa40f3394ab3a97a.zip
jitsi-601776d42f1d226b622881b3aa40f3394ab3a97a.tar.gz
jitsi-601776d42f1d226b622881b3aa40f3394ab3a97a.tar.bz2
- Works on removing the video of a video conference participant from display on the remaining non-focus participants. - Tries to fix a crash in PortAudio (often seen at the end of video conference calls).
Diffstat (limited to 'src/net')
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/call/UIVideoHandler.java88
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/CallPeerJabberImpl.java39
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/CallPeerMediaHandlerJabberImpl.java42
-rw-r--r--src/net/java/sip/communicator/impl/sysactivity/SysActivityActivator.java66
-rw-r--r--src/net/java/sip/communicator/impl/sysactivity/SystemActivityNotificationsServiceImpl.java120
-rw-r--r--src/net/java/sip/communicator/plugin/generalconfig/autoaway/AutoAwayConfigurationPanel.java16
-rw-r--r--src/net/java/sip/communicator/plugin/generalconfig/autoaway/AutoAwayWatcher.java120
-rw-r--r--src/net/java/sip/communicator/plugin/generalconfig/autoaway/StatusUpdateThread.java17
-rw-r--r--src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java16
9 files changed, 282 insertions, 242 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/call/UIVideoHandler.java b/src/net/java/sip/communicator/impl/gui/main/call/UIVideoHandler.java
index 338d6e3..60759c3 100644
--- a/src/net/java/sip/communicator/impl/gui/main/call/UIVideoHandler.java
+++ b/src/net/java/sip/communicator/impl/gui/main/call/UIVideoHandler.java
@@ -351,38 +351,38 @@ public class UIVideoHandler
* Removes the video listener
*/
public void removeVideoListener(
- CallPeer callPeer,
- VideoTelephonyListener videoTelephonyListener)
+ CallPeer callPeer,
+ VideoTelephonyListener videoTelephonyListener)
{
final Call call = callPeer.getCall();
if (call == null)
return;
- final OperationSetVideoTelephony telephony =
- call.getProtocolProvider()
- .getOperationSet(OperationSetVideoTelephony.class);
+ final OperationSetVideoTelephony telephony
+ = call.getProtocolProvider().getOperationSet(
+ OperationSetVideoTelephony.class);
if (telephony == null)
return;
if (videoTelephonyListener == null)
return;
- telephony.removeVideoListener(
- callPeer, videoTelephonyListener);
+ telephony.removeVideoListener(callPeer, videoTelephonyListener);
telephony.removeVisualComponentResolveListener(
- callPeer, videoTelephonyListener);
+ callPeer,
+ videoTelephonyListener);
if (!CallManager.isVideoStreaming(call) && isLocalVideoListenerAdded)
{
telephony.removePropertyChangeListener(
- call, videoTelephonyListener);
+ call,
+ videoTelephonyListener);
isLocalVideoListenerAdded = false;
if (localVideo != null)
{
- telephony.disposeLocalVisualComponent(
- callPeer, localVideo);
+ telephony.disposeLocalVisualComponent(callPeer, localVideo);
localVideo = null;
}
}
@@ -390,7 +390,7 @@ public class UIVideoHandler
synchronized (videoContainers)
{
if (!CallManager.isVideoStreaming(call)
- && telephony.equals(videoTelephony))
+ && telephony.equals(videoTelephony))
videoTelephony = null;
int videoContainerCount;
@@ -410,9 +410,7 @@ public class UIVideoHandler
if (memberToolbars != null)
{
for (ConferenceMember member : callPeer.getConferenceMembers())
- {
memberToolbars.remove(member);
- }
}
callRenderer.exitFullScreen();
@@ -510,7 +508,7 @@ public class UIVideoHandler
CallPanel callContainer = callRenderer.getCallContainer();
if (callContainer.isConference()
- && !(callRenderer instanceof VideoConferenceCallPanel))
+ && !(callRenderer instanceof VideoConferenceCallPanel))
{
callContainer.enableConferenceInterface(true);
}
@@ -524,10 +522,11 @@ public class UIVideoHandler
public void videoRemoved(VideoEvent event)
{
CallPanel callContainer = callRenderer.getCallContainer();
- if (callContainer.isConference()
- && callPeer.getCall() != null
- && !CallManager.isVideoStreaming(callPeer.getCall())
- && (callRenderer instanceof VideoConferenceCallPanel))
+
+ if (callContainer.isConference()
+ && (callPeer.getCall() != null)
+ && !CallManager.isVideoStreaming(callPeer.getCall())
+ && (callRenderer instanceof VideoConferenceCallPanel))
{
callContainer.enableConferenceInterface(false);
}
@@ -557,13 +556,15 @@ public class UIVideoHandler
// If the member is already added in the call we refresh the
// the video container, otherwise it will be refreshed when added.
- if ((CallManager.addressesAreEqual( confMember.getAddress(),
- focusCallPeer.getAddress())
- && peerToolbars.containsKey(focusCallPeer))
- || memberToolbars.containsKey(event.getConferenceMember()))
+ if ((CallManager.addressesAreEqual(
+ confMember.getAddress(),
+ focusCallPeer.getAddress())
+ && peerToolbars.containsKey(focusCallPeer))
+ || memberToolbars.containsKey(event.getConferenceMember()))
{
handleVideoEvent(
- confMember.getConferenceFocusCallPeer().getCall(), null);
+ confMember.getConferenceFocusCallPeer().getCall(),
+ null);
}
}
}
@@ -576,12 +577,16 @@ public class UIVideoHandler
* <tt>Component</tt> representing video and the provider it was added into
* or <tt>null</tt> if such information is not available
*/
- public void handleVideoEvent( final Call call,
- final VideoEvent event)
+ public void handleVideoEvent(final Call call, final VideoEvent event)
{
if (event != null && logger.isTraceEnabled())
- logger.trace("UI video event received originated in: "
- + event.getOrigin() + " and is of type: " + event.getType());
+ {
+ logger.trace(
+ "Received UI video event with origin "
+ + event.getOrigin()
+ + " and type "
+ + event.getType());
+ }
if ((event != null) && !event.isConsumed())
{
@@ -596,11 +601,11 @@ public class UIVideoHandler
switch (origin)
{
case VideoEvent.LOCAL:
- this.localVideo = video;
- this.closeButton = new CloseButton();
+ localVideo = video;
+ closeButton = new CloseButton();
break;
case VideoEvent.REMOTE:
- this.remoteVideo = video;
+ remoteVideo = video;
break;
}
@@ -619,13 +624,13 @@ public class UIVideoHandler
case VideoEvent.LOCAL:
if (localVideo == video)
{
- this.localVideo = null;
- this.closeButton = null;
+ localVideo = null;
+ closeButton = null;
}
break;
case VideoEvent.REMOTE:
if (remoteVideo == video)
- this.remoteVideo = null;
+ remoteVideo = null;
break;
}
break;
@@ -1607,6 +1612,21 @@ public class UIVideoHandler
return remoteVideo;
}
+ /**
+ * Creates a new <tt>Component</tt> which is to display a specific
+ * <tt>ImageIcon</tt> representing the photo of a participant in a call and
+ * a <tt>Component</tt> depicting a bar of tools related to video.
+ *
+ * @param photoLabelIcon the <tt>ImageIcon</tt> which represents the photo
+ * of a participant in a call and which is to be displayed by the new
+ * <tt>Component</tt>
+ * @param videoToolbar the <tt>Component</tt> which represents a bar of
+ * tools related to the video and associated with the call participant
+ * depicted by <tt>photoLabelIcon</tt> and which is to be added into the new
+ * <tt>Component</tt>
+ * @return a new <tt>Component</tt> which displays the specified
+ * <tt>photoLabelIcon</tt> and <tt>videoToolbar</tt>
+ */
private Component createDefaultPhotoPanel(
ImageIcon photoLabelIcon,
Component videoToolbar)
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerJabberImpl.java
index 92f00d1..551e97f 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerJabberImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerJabberImpl.java
@@ -14,7 +14,6 @@ import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.ContentP
import net.java.sip.communicator.impl.protocol.jabber.jinglesdp.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
-import net.java.sip.communicator.service.protocol.media.*;
import net.java.sip.communicator.util.*;
import org.jitsi.service.neomedia.*;
@@ -883,8 +882,8 @@ public class CallPeerJabberImpl
public void sendModifyVideoContent(boolean allowed)
{
ContentPacketExtension ext = new ContentPacketExtension();
- ContentPacketExtension remoteContent = getMediaHandler().
- getRemoteContent(MediaType.VIDEO.toString());
+ ContentPacketExtension remoteContent
+ = getMediaHandler().getRemoteContent(MediaType.VIDEO.toString());
if(remoteContent == null)
{
@@ -892,11 +891,13 @@ public class CallPeerJabberImpl
sendAddVideoContent();
return;
}
- else if(!allowed &&
- ((!isInitiator &&
- remoteContent.getSenders() == SendersEnum.initiator) ||
- (isInitiator &&
- remoteContent.getSenders() == SendersEnum.responder)))
+ else if(!allowed
+ && ((!isInitiator
+ && (remoteContent.getSenders()
+ == SendersEnum.initiator))
+ || (isInitiator
+ && (remoteContent.getSenders()
+ == SendersEnum.responder))))
{
sendRemoveVideoContent();
return;
@@ -940,21 +941,27 @@ public class CallPeerJabberImpl
ext.setCreator(remoteContent.getCreator());
ext.setName(remoteContent.getName());
- JingleIQ contentIQ = JinglePacketFactory
- .createContentModify(getProtocolProvider().getOurJID(),
- this.peerJID, getJingleSID(), ext);
+ ProtocolProviderServiceJabberImpl protocolProvider
+ = getProtocolProvider();
+ JingleIQ contentIQ
+ = JinglePacketFactory.createContentModify(
+ protocolProvider.getOurJID(),
+ this.peerJID,
+ getJingleSID(),
+ ext);
- getProtocolProvider().getConnection().sendPacket(contentIQ);
+ protocolProvider.getConnection().sendPacket(contentIQ);
try
{
- getMediaHandler().reinitContent(remoteContent.getName(), ext,
- false);
- getMediaHandler().start();
+ CallPeerMediaHandlerJabberImpl mediaHandler = getMediaHandler();
+
+ mediaHandler.reinitContent(remoteContent.getName(), ext, false);
+ mediaHandler.start();
}
catch(Exception e)
{
- logger.warn("Exception occurred when media reinitialization", e);
+ logger.warn("Exception occurred during media reinitialization", e);
}
}
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerMediaHandlerJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerMediaHandlerJabberImpl.java
index 54643bc..a97fefe 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerMediaHandlerJabberImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerMediaHandlerJabberImpl.java
@@ -6,8 +6,6 @@
*/
package net.java.sip.communicator.impl.protocol.jabber;
-import ch.imvs.sdes4j.srtp.*;
-
import java.lang.reflect.*;
import java.util.*;
@@ -1008,8 +1006,8 @@ public class CallPeerMediaHandlerJabberImpl
return;
}
- List<MediaFormat> supportedFormats = JingleUtils.extractFormats(
- description, getDynamicPayloadTypes());
+ List<MediaFormat> supportedFormats
+ = JingleUtils.extractFormats(description, getDynamicPayloadTypes());
MediaDevice dev = getDefaultDevice(mediaType);
@@ -1032,8 +1030,10 @@ public class CallPeerMediaHandlerJabberImpl
//remote party must have messed up our Jingle description.
//throw an exception.
ProtocolProviderServiceJabberImpl.throwOperationFailedException(
- "Remote party sent an invalid Jingle answer.",
- OperationFailedException.ILLEGAL_ARGUMENT, null, logger);
+ "Remote party sent an invalid Jingle answer.",
+ OperationFailedException.ILLEGAL_ARGUMENT,
+ null,
+ logger);
}
addZRTPAdvertisedEncryptions(true, description, mediaType);
@@ -1045,7 +1045,6 @@ public class CallPeerMediaHandlerJabberImpl
//determine the direction that we need to announce.
MediaDirection remoteDirection
= JingleUtils.getDirection(content, getPeer().isInitiator());
-
MediaDirection direction
= devDirection.getDirectionForAnswer(remoteDirection);
@@ -1053,22 +1052,20 @@ public class CallPeerMediaHandlerJabberImpl
List<RTPExtension> remoteRTPExtensions
= JingleUtils.extractRTPExtensions(
description, getRtpExtensionsRegistry());
-
List<RTPExtension> supportedExtensions
= getExtensionsForType(mediaType);
+ List<RTPExtension> rtpExtensions
+ = intersectRTPExtensions(remoteRTPExtensions, supportedExtensions);
- List<RTPExtension> rtpExtensions = intersectRTPExtensions(
- remoteRTPExtensions, supportedExtensions);
+ Map<String, String> adv
+ = supportedFormats.get(0).getAdvancedAttributes();
- Map<String, String> adv = supportedFormats.get(0).getAdvancedAttributes();
if(adv != null)
{
for(Map.Entry<String, String> f : adv.entrySet())
{
if(f.getKey().equals("imageattr"))
- {
supportQualityControls = true;
- }
}
}
@@ -1090,7 +1087,7 @@ public class CallPeerMediaHandlerJabberImpl
MediaFormat fmt = fmts.get(0);
((VideoMediaStream)stream).updateQualityControl(
- fmt.getAdvancedAttributes());
+ fmt.getAdvancedAttributes());
}
}
@@ -1103,15 +1100,22 @@ public class CallPeerMediaHandlerJabberImpl
= (dev == null)
? null
: intersectFormats(
- supportedFormats,
- dev.getSupportedFormats(
- sendQualityPreset, receiveQualityPreset));
+ supportedFormats,
+ dev.getSupportedFormats(
+ sendQualityPreset,
+ receiveQualityPreset));
}
}
// create the corresponding stream...
- initStream(content.getName(), connector, dev,
- supportedFormats.get(0), target, direction, rtpExtensions,
+ initStream(
+ content.getName(),
+ connector,
+ dev,
+ supportedFormats.get(0),
+ target,
+ direction,
+ rtpExtensions,
masterStream);
}
diff --git a/src/net/java/sip/communicator/impl/sysactivity/SysActivityActivator.java b/src/net/java/sip/communicator/impl/sysactivity/SysActivityActivator.java
index 90b30df..923c699 100644
--- a/src/net/java/sip/communicator/impl/sysactivity/SysActivityActivator.java
+++ b/src/net/java/sip/communicator/impl/sysactivity/SysActivityActivator.java
@@ -13,7 +13,7 @@ import org.osgi.framework.*;
/**
* Listens for system activity changes like sleep, network change, inactivity
- * and inform all its listeners.
+ * and informs all its listeners.
*
* @author Damian Minkov
*/
@@ -21,65 +21,46 @@ public class SysActivityActivator
implements BundleActivator
{
/**
- * The logger.
+ * The <tt>Logger</tt> used by this <tt>SysActivityActivator</tt> for
+ * logging output.
*/
private final Logger logger = Logger.getLogger(SysActivityActivator.class);
/**
- * The OSGi service registration.
- */
- private ServiceRegistration sysActivitiesServReg = null;
-
- /**
- * The OSGi <tt>BundleContext</tt>.
- */
- private static BundleContext bundleContext = null;
-
- /**
* The system activity service impl.
*/
- private static SystemActivityNotificationsServiceImpl sysActivitiesServiceImpl;
+ private static SystemActivityNotificationsServiceImpl
+ sysActivitiesServiceImpl;
/**
* Called when this bundle is started so the Framework can perform the
* bundle-specific activities necessary to start this bundle.
*
- * @param context The execution context of the bundle being started.
+ * @param bundleContext The execution context of the bundle being started.
* @throws Exception If this method throws an exception, this bundle is
- * marked as stopped and the Framework will remove this bundle's
- * listeners, unregister all services registered by this bundle, and
- * release all services used by this bundle.
+ * marked as stopped and the Framework will remove this bundle's listeners,
+ * unregister all services registered by this bundle, and release all
+ * services used by this bundle.
*/
- public void start(BundleContext context)
+ public void start(BundleContext bundleContext)
throws Exception
{
if (logger.isDebugEnabled())
logger.debug("Started.");
- SysActivityActivator.bundleContext = context;
sysActivitiesServiceImpl = new SystemActivityNotificationsServiceImpl();
sysActivitiesServiceImpl.start();
- sysActivitiesServReg = context.registerService(
- SystemActivityNotificationsService.class.getName(),
- sysActivitiesServiceImpl,
- null);
+ bundleContext.registerService(
+ SystemActivityNotificationsService.class.getName(),
+ sysActivitiesServiceImpl,
+ null);
}
/**
* Returns a reference to the bundle context that we were started with.
* @return a reference to the BundleContext instance that we were started
- * witn.
- */
- public static BundleContext getBundleContext()
- {
- return bundleContext;
- }
-
- /**
- * Returns a reference to the bundle context that we were started with.
- * @return a reference to the BundleContext instance that we were started
- * witn.
+ * with.
*/
public static SystemActivityNotificationsServiceImpl
getSystemActivityService()
@@ -91,17 +72,16 @@ public class SysActivityActivator
* Called when this bundle is stopped so the Framework can perform the
* bundle-specific activities necessary to stop the bundle.
*
- * @param context The execution context of the bundle being stopped.
- * @throws Exception If this method throws an exception, the bundle is
- * still marked as stopped, and the Framework will remove the bundle's
- * listeners, unregister all services registered by the bundle, and
- * release all services used by the bundle.
+ * @param bundleContext The execution context of the bundle being stopped.
+ * @throws Exception If this method throws an exception, the bundle is still
+ * marked as stopped, and the Framework will remove the bundle's listeners,
+ * unregister all services registered by the bundle, and release all
+ * services used by the bundle.
*/
- public void stop(BundleContext context) throws Exception
+ public void stop(BundleContext bundleContext)
+ throws Exception
{
- sysActivitiesServReg.unregister();
-
- if(sysActivitiesServiceImpl != null)
+ if (sysActivitiesServiceImpl != null)
sysActivitiesServiceImpl.stop();
}
}
diff --git a/src/net/java/sip/communicator/impl/sysactivity/SystemActivityNotificationsServiceImpl.java b/src/net/java/sip/communicator/impl/sysactivity/SystemActivityNotificationsServiceImpl.java
index 9a2ad63..f7b7a78 100644
--- a/src/net/java/sip/communicator/impl/sysactivity/SystemActivityNotificationsServiceImpl.java
+++ b/src/net/java/sip/communicator/impl/sysactivity/SystemActivityNotificationsServiceImpl.java
@@ -26,34 +26,35 @@ public class SystemActivityNotificationsServiceImpl
Runnable
{
/**
- * The logger.
+ * The <tt>Logger</tt> used by this
+ * <tt>SystemActivityNotificationsServiceImpl</tt> for logging output.
*/
- private Logger logger = Logger.getLogger(
- SystemActivityNotificationsServiceImpl.class.getName());
+ private final Logger logger
+ = Logger.getLogger(SystemActivityNotificationsServiceImpl.class);
/**
* The thread dispatcher of network change events.
*/
- private SystemActivityEventDispatcher eventDispatcher =
- new SystemActivityEventDispatcher();
+ private final SystemActivityEventDispatcher eventDispatcher
+ = new SystemActivityEventDispatcher();
/**
* A list of listeners registered for idle events.
*/
- private final Map<SystemActivityChangeListener,Long> idleChangeListeners =
- new HashMap<SystemActivityChangeListener, Long>();
+ private final Map<SystemActivityChangeListener,Long> idleChangeListeners
+ = new HashMap<SystemActivityChangeListener, Long>();
/**
* Listeners which are fired for idle state and which will be fired
* with idle end when needed.
*/
private final List<SystemActivityChangeListener> listenersInIdleState
- = new ArrayList<SystemActivityChangeListener>();
+ = new ArrayList<SystemActivityChangeListener>();
/**
* The interval between checks when not idle.
*/
- private static final int CHECK_FOR_IDLE_DEFAULT = 30*1000;
+ private static final int CHECK_FOR_IDLE_DEFAULT = 30 * 1000;
/**
* The interval between checks when idle. The interval is shorter
@@ -96,28 +97,32 @@ public class SystemActivityNotificationsServiceImpl
// set the delegate and start notification in new thread
// make sure we don't block startup process
- Thread notifystartThread = new Thread(new Runnable() {
- public void run()
- {
- SystemActivityNotifications.setDelegate(
- SystemActivityNotificationsServiceImpl.this);
- SystemActivityNotifications.start();
- }
- }, "SystemActivityNotificationsServiceImpl");
+ Thread notifystartThread
+ = new Thread(
+ new Runnable()
+ {
+ public void run()
+ {
+ SystemActivityNotifications.setDelegate(
+ SystemActivityNotificationsServiceImpl.this);
+ SystemActivityNotifications.start();
+ }
+ },
+ "SystemActivityNotificationsServiceImpl");
notifystartThread.setDaemon(true);
notifystartThread.start();
// a thread periodically checks system idle state and if it pass the
// idle time for a particular listener, will inform it.
- Thread idleNotifyThread = new Thread(this,
- "SystemActivityNotificationsServiceImpl.IdleNotifyThread");
+ Thread idleNotifyThread
+ = new Thread(
+ this,
+ "SystemActivityNotificationsServiceImpl.IdleNotifyThread");
idleNotifyThread.setDaemon(true);
idleNotifyThread.start();
- if(OSUtils.IS_LINUX)
- {
+ if (OSUtils.IS_LINUX)
NetworkManagerListenerImpl.getInstance().start();
- }
}
/**
@@ -127,10 +132,8 @@ public class SystemActivityNotificationsServiceImpl
{
SystemActivityNotifications.stop();
- if(OSUtils.IS_LINUX)
- {
+ if (OSUtils.IS_LINUX)
NetworkManagerListenerImpl.getInstance().stop();
- }
eventDispatcher.stop();
@@ -150,7 +153,7 @@ public class SystemActivityNotificationsServiceImpl
* the underlying system.
*/
public void addSystemActivityChangeListener(
- SystemActivityChangeListener listener)
+ SystemActivityChangeListener listener)
{
eventDispatcher.addSystemActivityChangeListener(listener);
}
@@ -162,7 +165,7 @@ public class SystemActivityNotificationsServiceImpl
* @param listener the listener to remove.
*/
public void removeSystemActivityChangeListener(
- SystemActivityChangeListener listener)
+ SystemActivityChangeListener listener)
{
eventDispatcher.removeSystemActivityChangeListener(listener);
}
@@ -178,15 +181,13 @@ public class SystemActivityNotificationsServiceImpl
* the underlying system.
*/
public void addIdleSystemChangeListener(
- long idleTime,
- SystemActivityChangeListener listener)
+ long idleTime,
+ SystemActivityChangeListener listener)
{
synchronized (idleChangeListeners)
{
if (!idleChangeListeners.containsKey(listener))
- {
idleChangeListeners.put(listener, idleTime);
- }
}
}
@@ -197,7 +198,7 @@ public class SystemActivityNotificationsServiceImpl
* @param listener the listener to remove.
*/
public void removeIdleSystemChangeListener(
- SystemActivityChangeListener listener)
+ SystemActivityChangeListener listener)
{
synchronized (idleChangeListeners)
{
@@ -278,7 +279,7 @@ public class SystemActivityNotificationsServiceImpl
}
}
- if(evt != null)
+ if (evt != null)
fireSystemActivityEvent(evt);
}
@@ -307,11 +308,11 @@ public class SystemActivityNotificationsServiceImpl
*/
@Override
public void notifyNetworkChange(
- int family,
- long luidIndex,
- String name,
- long type,
- boolean connected)
+ int family,
+ long luidIndex,
+ String name,
+ long type,
+ boolean connected)
{
long current = System.currentTimeMillis();
if(current - lastNetworkChange <= NETWORK_EVENT_SILENT_TIME
@@ -346,26 +347,25 @@ public class SystemActivityNotificationsServiceImpl
// check
idleTime = SystemActivityNotifications.getLastInput();
- if(idleTime < idleStateCheckDelay
- && listenersInIdleState.size() > 0)
+ if((idleTime < idleStateCheckDelay)
+ && (listenersInIdleState.size() > 0))
{
- for(SystemActivityChangeListener l: listenersInIdleState)
+ for(SystemActivityChangeListener l
+ : listenersInIdleState)
{
fireSystemIdleEndEvent(l);
}
listenersInIdleState.clear();
}
- for(Map.Entry<SystemActivityChangeListener, Long> entry :
- idleChangeListeners.entrySet())
+ for(Map.Entry<SystemActivityChangeListener, Long> entry
+ : idleChangeListeners.entrySet())
{
SystemActivityChangeListener listener =
entry.getKey();
- if(listenersInIdleState.contains(listener))
- continue;
-
- if(entry.getValue() <= idleTime)
+ if(!listenersInIdleState.contains(listener)
+ && (entry.getValue() <= idleTime))
{
fireSystemIdleEvent(listener);
@@ -452,8 +452,10 @@ public class SystemActivityNotificationsServiceImpl
*/
protected void fireSystemIdleEvent(SystemActivityChangeListener listener)
{
- SystemActivityEvent evt = new SystemActivityEvent(
- this, SystemActivityEvent.EVENT_SYSTEM_IDLE);
+ SystemActivityEvent evt
+ = new SystemActivityEvent(
+ this,
+ SystemActivityEvent.EVENT_SYSTEM_IDLE);
if (logger.isDebugEnabled())
logger.debug("Dispatching SystemActivityEvent evt=" + evt);
@@ -462,9 +464,12 @@ public class SystemActivityNotificationsServiceImpl
{
listener.activityChanged(evt);
}
- catch (Throwable e)
+ catch (Throwable t)
{
- logger.error("Error delivering event", e);
+ if (t instanceof ThreadDeath)
+ throw (ThreadDeath) t;
+ else
+ logger.error("Error delivering event", t);
}
}
@@ -476,8 +481,10 @@ public class SystemActivityNotificationsServiceImpl
protected void fireSystemIdleEndEvent(
SystemActivityChangeListener listener)
{
- SystemActivityEvent evt = new SystemActivityEvent(
- this, SystemActivityEvent.EVENT_SYSTEM_IDLE_END);
+ SystemActivityEvent evt
+ = new SystemActivityEvent(
+ this,
+ SystemActivityEvent.EVENT_SYSTEM_IDLE_END);
if (logger.isDebugEnabled())
logger.debug("Dispatching SystemActivityEvent evt=" + evt);
@@ -486,9 +493,12 @@ public class SystemActivityNotificationsServiceImpl
{
listener.activityChanged(evt);
}
- catch (Throwable e)
+ catch (Throwable t)
{
- logger.error("Error delivering event", e);
+ if (t instanceof ThreadDeath)
+ throw (ThreadDeath) t;
+ else
+ logger.error("Error delivering event", t);
}
}
diff --git a/src/net/java/sip/communicator/plugin/generalconfig/autoaway/AutoAwayConfigurationPanel.java b/src/net/java/sip/communicator/plugin/generalconfig/autoaway/AutoAwayConfigurationPanel.java
index 4b2646e..8069997 100644
--- a/src/net/java/sip/communicator/plugin/generalconfig/autoaway/AutoAwayConfigurationPanel.java
+++ b/src/net/java/sip/communicator/plugin/generalconfig/autoaway/AutoAwayConfigurationPanel.java
@@ -126,8 +126,10 @@ public class AutoAwayConfigurationPanel
catch(NumberFormatException r){}
}
- boolean e = configService.getBoolean(Preferences.ENABLE,
- Boolean.parseBoolean(enabledDefault));
+ boolean e
+ = configService.getBoolean(
+ Preferences.ENABLE,
+ Boolean.parseBoolean(enabledDefault));
this.enable.setSelected(e);
this.timer.setEnabled(e);
@@ -143,9 +145,11 @@ public class AutoAwayConfigurationPanel
ConfigurationService configService
= GeneralConfigPluginActivator.getConfigurationService();
- configService.setProperty(Preferences.ENABLE,
- Boolean.toString(enable.isSelected()));
- configService.setProperty(Preferences.TIMER,
- timer.getValue().toString());
+ configService.setProperty(
+ Preferences.ENABLE,
+ Boolean.toString(enable.isSelected()));
+ configService.setProperty(
+ Preferences.TIMER,
+ timer.getValue().toString());
}
}
diff --git a/src/net/java/sip/communicator/plugin/generalconfig/autoaway/AutoAwayWatcher.java b/src/net/java/sip/communicator/plugin/generalconfig/autoaway/AutoAwayWatcher.java
index 80efeb8..303b013 100644
--- a/src/net/java/sip/communicator/plugin/generalconfig/autoaway/AutoAwayWatcher.java
+++ b/src/net/java/sip/communicator/plugin/generalconfig/autoaway/AutoAwayWatcher.java
@@ -21,6 +21,7 @@ import org.osgi.framework.*;
/**
* Listens for idle events from SystemActivityNotifications Service.
+ *
* @author Damian Minkov
*/
public class AutoAwayWatcher
@@ -51,12 +52,16 @@ public class AutoAwayWatcher
public AutoAwayWatcher(ConfigurationService configurationService)
{
// if enabled start
- String enabledDefault = GeneralConfigPluginActivator.getResources()
- .getSettingsString(Preferences.ENABLE);
+ String enabledDefault
+ = GeneralConfigPluginActivator.getResources().getSettingsString(
+ Preferences.ENABLE);
- if(configurationService.getBoolean(Preferences.ENABLE,
- Boolean.valueOf(enabledDefault)))
+ if (configurationService.getBoolean(
+ Preferences.ENABLE,
+ Boolean.parseBoolean(enabledDefault)))
+ {
start();
+ }
// listens for changes in configuration enable/disable
configurationService.addPropertyChangeListener(
@@ -65,7 +70,7 @@ public class AutoAwayWatcher
{
public void propertyChange(PropertyChangeEvent evt)
{
- if(Boolean.parseBoolean((String)evt.getNewValue()))
+ if(Boolean.parseBoolean((String) evt.getNewValue()))
start();
else
stopInner();
@@ -129,10 +134,14 @@ public class AutoAwayWatcher
{
idleListener = new IdleListener();
- getSystemActivityNotificationsService()
- .addIdleSystemChangeListener(
- StatusUpdateThread.getTimer()*60*1000, idleListener);
- getSystemActivityNotificationsService()
+ SystemActivityNotificationsService
+ systemActivityNotificationsService
+ = getSystemActivityNotificationsService();
+
+ systemActivityNotificationsService.addIdleSystemChangeListener(
+ StatusUpdateThread.getTimer() * 60 * 1000,
+ idleListener);
+ systemActivityNotificationsService
.addSystemActivityChangeListener(idleListener);
}
}
@@ -151,14 +160,19 @@ public class AutoAwayWatcher
*/
private void stopInner()
{
- if(idleListener == null)
- return;
+ if(idleListener != null)
+ {
+ SystemActivityNotificationsService
+ systemActivityNotificationsService
+ = getSystemActivityNotificationsService();
- getSystemActivityNotificationsService()
- .removeIdleSystemChangeListener(idleListener);
- getSystemActivityNotificationsService()
- .removeSystemActivityChangeListener(idleListener);
- idleListener = null;
+ systemActivityNotificationsService.removeIdleSystemChangeListener(
+ idleListener);
+ systemActivityNotificationsService
+ .removeSystemActivityChangeListener(idleListener);
+
+ idleListener = null;
+ }
}
/**
@@ -171,18 +185,15 @@ public class AutoAwayWatcher
: GeneralConfigPluginActivator.getProtocolProviders())
{
OperationSetPresence presence
- = protocolProviderService
- .getOperationSet(
- OperationSetPresence.class);
+ = protocolProviderService.getOperationSet(
+ OperationSetPresence.class);
if(presence == null)
continue;
- PresenceStatus status = presence
- .getPresenceStatus();
+ PresenceStatus status = presence.getPresenceStatus();
- if (status.getStatus()
- < PresenceStatus.AVAILABLE_THRESHOLD)
+ if (status.getStatus() < PresenceStatus.AVAILABLE_THRESHOLD)
{
// already (manually) set to away or lower
continue;
@@ -190,21 +201,25 @@ public class AutoAwayWatcher
addProviderToLastStates(protocolProviderService, status);
- PresenceStatus newStatus =
- StatusUpdateThread.findAwayStatus(presence);
+ PresenceStatus newStatus
+ = StatusUpdateThread.findAwayStatus(presence);
try
{
if (newStatus != null)
- presence
- .publishPresenceStatus(
- newStatus,
- newStatus.getStatusName());
- } catch (IllegalArgumentException e)
+ {
+ presence.publishPresenceStatus(
+ newStatus,
+ newStatus.getStatusName());
+ }
+ }
+ catch (IllegalArgumentException e)
{
- } catch (IllegalStateException e)
+ }
+ catch (IllegalStateException e)
{
- } catch (OperationFailedException e)
+ }
+ catch (OperationFailedException e)
{
}
}
@@ -231,11 +246,13 @@ public class AutoAwayWatcher
{
presence
.publishPresenceStatus(lastState, "");
- } catch (IllegalArgumentException e)
+ }
+ catch (IllegalArgumentException e)
{
- } catch (IllegalStateException e)
+ }catch (IllegalStateException e)
{
- } catch (OperationFailedException e)
+ }
+ catch (OperationFailedException e)
{
}
removeProviderFromLastStates(protocolProviderService);
@@ -250,7 +267,8 @@ public class AutoAwayWatcher
private SystemActivityNotificationsService
getSystemActivityNotificationsService()
{
- return ServiceUtils.getService(
+ return
+ ServiceUtils.getService(
GeneralConfigPluginActivator.bundleContext,
SystemActivityNotificationsService.class);
}
@@ -265,22 +283,19 @@ public class AutoAwayWatcher
*/
public void serviceChanged(ServiceEvent serviceEvent)
{
- Object sService = GeneralConfigPluginActivator.bundleContext
- .getService(serviceEvent.getServiceReference());
+ Object service
+ = GeneralConfigPluginActivator.bundleContext.getService(
+ serviceEvent.getServiceReference());
// we don't care if the source service is not a protocol provider
- if (! (sService instanceof ProtocolProviderService))
+ if (service instanceof ProtocolProviderService)
{
- return;
- }
+ int serviceEventType = serviceEvent.getType();
- if (serviceEvent.getType() == ServiceEvent.REGISTERED)
- {
- this.handleProviderAdded((ProtocolProviderService)sService);
- }
- else if (serviceEvent.getType() == ServiceEvent.UNREGISTERING)
- {
- this.handleProviderRemoved( (ProtocolProviderService) sService);
+ if (serviceEventType == ServiceEvent.REGISTERED)
+ handleProviderAdded((ProtocolProviderService) service);
+ else if (serviceEventType == ServiceEvent.UNREGISTERING)
+ handleProviderRemoved((ProtocolProviderService) service);
}
}
@@ -290,7 +305,7 @@ public class AutoAwayWatcher
* @param provider ProtocolProviderService
*/
private synchronized void handleProviderAdded(
- ProtocolProviderService provider)
+ ProtocolProviderService provider)
{
provider.addRegistrationStateChangeListener(this);
}
@@ -316,9 +331,7 @@ public class AutoAwayWatcher
lastStates.remove(provider);
if(lastStates.size() == 0)
- {
stopInner();
- }
}
/**
@@ -328,12 +341,11 @@ public class AutoAwayWatcher
* @param status the status to save.
*/
private synchronized void addProviderToLastStates(
- ProtocolProviderService provider, PresenceStatus status)
+ ProtocolProviderService provider,
+ PresenceStatus status)
{
if(lastStates.size() == 0)
- {
start();
- }
lastStates.put(provider, status);
}
diff --git a/src/net/java/sip/communicator/plugin/generalconfig/autoaway/StatusUpdateThread.java b/src/net/java/sip/communicator/plugin/generalconfig/autoaway/StatusUpdateThread.java
index 601f2b9..749de02 100644
--- a/src/net/java/sip/communicator/plugin/generalconfig/autoaway/StatusUpdateThread.java
+++ b/src/net/java/sip/communicator/plugin/generalconfig/autoaway/StatusUpdateThread.java
@@ -175,25 +175,26 @@ public class StatusUpdateThread
ResourceManagementService resources
= GeneralConfigPluginActivator.getResources();
- String enabledDefault =
- resources.getSettingsString(Preferences.ENABLE);
+ String enabledDefault = resources.getSettingsString(Preferences.ENABLE);
- String timerDefaultStr =
- resources.getSettingsString(Preferences.TIMER);
+ String timerDefaultStr = resources.getSettingsString(Preferences.TIMER);
int timerDefault = 0;
- if(timerDefaultStr != null)
+ if (timerDefaultStr != null)
{
try
{
timerDefault = Integer.parseInt(timerDefaultStr);
}
- catch(NumberFormatException r){}
+ catch (NumberFormatException r)
+ {
+ }
}
return
- configService.getBoolean(Preferences.ENABLE,
- Boolean.valueOf(enabledDefault))
+ configService.getBoolean(
+ Preferences.ENABLE,
+ Boolean.parseBoolean(enabledDefault))
? configService.getInt(Preferences.TIMER, timerDefault)
: 0;
}
diff --git a/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java b/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java
index cb9270d..d7585e5 100644
--- a/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java
+++ b/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java
@@ -1310,7 +1310,8 @@ public abstract class CallPeerMediaHandler
*/
firePropertyChange(
OperationSetVideoTelephony.LOCAL_VIDEO_STREAMING,
- null, this.videoDirectionUserPreference);
+ null,
+ this.videoDirectionUserPreference);
if(!stream.isStarted())
{
@@ -1319,13 +1320,14 @@ public abstract class CallPeerMediaHandler
MediaType.VIDEO);
stream.start();
- // send empty packet to deblock some kind of RTP proxy to let
- // just one user sends its video
- if ((stream instanceof VideoMediaStream)
- /* && !isLocalVideoTransmissionEnabled() */)
- {
+ /*
+ * Send an empty packet to unblock some kinds of RTP proxies.
+ * Do not consult whether the local video should be streamed and
+ * send the hole-punch packet anyway to let the remote video
+ * reach this local peer.
+ */
+ if (stream instanceof VideoMediaStream)
sendHolePunchPacket(stream.getTarget());
- }
}
}
}