diff options
author | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2012-01-30 13:35:58 +0000 |
---|---|---|
committer | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2012-01-30 13:35:58 +0000 |
commit | 324dc167e9aeae04bcb7679a8678fd20a6a784c6 (patch) | |
tree | c76d487cffd0aac0ae5e068c22b5e65f02670d02 /src/net/java | |
parent | 67f9226af63edc34813e7d33e6c748c15e22d117 (diff) | |
download | jitsi-324dc167e9aeae04bcb7679a8678fd20a6a784c6.zip jitsi-324dc167e9aeae04bcb7679a8678fd20a6a784c6.tar.gz jitsi-324dc167e9aeae04bcb7679a8678fd20a6a784c6.tar.bz2 |
Fixes warnings, typos.
Diffstat (limited to 'src/net/java')
7 files changed, 109 insertions, 91 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java index 6f75de2..f401970 100755 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java @@ -596,7 +596,7 @@ public class ChatWritePanel ArrayList<String> contacts = new ArrayList<String>(); while(iter.hasNext()) { - ChatContact c = iter.next(); + ChatContact<?> c = iter.next(); if(c.getName().length() >= (index-position) && c.getName().substring(0,index-position).equals(sequence)) { diff --git a/src/net/java/sip/communicator/impl/neomedia/CallRecordingConfigForm.java b/src/net/java/sip/communicator/impl/neomedia/CallRecordingConfigForm.java index e1dff1e..3e20266 100644 --- a/src/net/java/sip/communicator/impl/neomedia/CallRecordingConfigForm.java +++ b/src/net/java/sip/communicator/impl/neomedia/CallRecordingConfigForm.java @@ -29,7 +29,7 @@ public class CallRecordingConfigForm DocumentListener { /** - * Sesrial version UID. + * Serial version UID. */ private static final long serialVersionUID = 0L; diff --git a/src/net/java/sip/communicator/impl/neomedia/RTCPConnectorInputStream.java b/src/net/java/sip/communicator/impl/neomedia/RTCPConnectorInputStream.java index e3ef66d..d25f1eb 100644 --- a/src/net/java/sip/communicator/impl/neomedia/RTCPConnectorInputStream.java +++ b/src/net/java/sip/communicator/impl/neomedia/RTCPConnectorInputStream.java @@ -14,7 +14,7 @@ import net.java.sip.communicator.service.neomedia.event.*; /** * @author Bing SU (nova.su@gmail.com) - * @author Lubomir Marinov + * @author Lyubomir Marinov * @author Sebastien Vincent */ public class RTCPConnectorInputStream @@ -23,8 +23,8 @@ public class RTCPConnectorInputStream /** * List of feedback listeners; */ - private List<RTCPFeedbackListener> listeners = - new ArrayList<RTCPFeedbackListener>(); + private final List<RTCPFeedbackListener> rtcpFeedbackListeners + = new ArrayList<RTCPFeedbackListener>(); /** * Initializes a new <tt>RTCPConnectorInputStream</tt> which is to receive @@ -45,10 +45,8 @@ public class RTCPConnectorInputStream */ public void addRTCPFeedbackListener(RTCPFeedbackListener listener) { - if(!listeners.contains(listener)) - { - listeners.add(listener); - } + if(!rtcpFeedbackListeners.contains(listener)) + rtcpFeedbackListeners.add(listener); } /** @@ -58,10 +56,7 @@ public class RTCPConnectorInputStream */ public void removeRTCPFeedbackListener(RTCPFeedbackListener listener) { - if(listeners.contains(listener)) - { - listeners.remove(listener); - } + rtcpFeedbackListeners.remove(listener); } /** @@ -114,10 +109,8 @@ public class RTCPConnectorInputStream RTCPFeedbackEvent evt = new RTCPFeedbackEvent(this, fmt, pt); /* notify feedback listeners */ - for(RTCPFeedbackListener l : listeners) - { + for(RTCPFeedbackListener l : rtcpFeedbackListeners) l.feedbackReceived(evt); - } } System.arraycopy( diff --git a/src/net/java/sip/communicator/impl/neomedia/RTPConnectorOutputStream.java b/src/net/java/sip/communicator/impl/neomedia/RTPConnectorOutputStream.java index 9728cd3..4c12ee8 100755 --- a/src/net/java/sip/communicator/impl/neomedia/RTPConnectorOutputStream.java +++ b/src/net/java/sip/communicator/impl/neomedia/RTPConnectorOutputStream.java @@ -33,7 +33,7 @@ public abstract class RTPConnectorOutputStream * <tt>OutOfMemoryError</tt>s which, technically, may arise if the capacity
* of the queue is unlimited.
*/
- private static final int
+ public static final int
MAX_PACKETS_PER_MILLIS_POLICY_PACKET_QUEUE_CAPACITY
= 256;
@@ -45,7 +45,7 @@ public abstract class RTPConnectorOutputStream private MaxPacketsPerMillisPolicy maxPacketsPerMillisPolicy;
/**
- * Stream targets' ip addresses and ports.
+ * Stream targets' IP addresses and ports.
*/
protected final List<InetSocketAddress> targets
= new LinkedList<InetSocketAddress>();
@@ -184,23 +184,28 @@ public abstract class RTPConnectorOutputStream * @param target the target
* @throws IOException if something goes wrong during sending
*/
- protected abstract void sendToTarget(RawPacket packet,
- InetSocketAddress target) throws IOException;
+ protected abstract void sendToTarget(
+ RawPacket packet,
+ InetSocketAddress target)
+ throws IOException;
/**
- * Log the packet.
+ * Logs a specific <tt>RawPacket</tt> associated with a specific remote
+ * address.
*
* @param packet packet to log
+ * @param target the remote address associated with the <tt>packet</tt>
*/
- protected abstract void doLogPacket(RawPacket packet,
+ protected abstract void doLogPacket(
+ RawPacket packet,
InetSocketAddress target);
/**
* Returns whether or not this <tt>RTPConnectorOutputStream</tt> has a valid
* socket.
*
- * @returns true if this <tt>RTPConnectorOutputStream</tt> has a valid
- * socket, false otherwise
+ * @return <tt>true</tt> if this <tt>RTPConnectorOutputStream</tt> has a
+ * valid socket; <tt>false</tt>, otherwise
*/
protected abstract boolean isSocketValid();
@@ -216,9 +221,7 @@ public abstract class RTPConnectorOutputStream private boolean send(RawPacket packet)
{
if(!isSocketValid())
- {
return false;
- }
numberOfPackets++;
for (InetSocketAddress target : targets)
diff --git a/src/net/java/sip/communicator/impl/neomedia/device/Video4Linux2Auto.java b/src/net/java/sip/communicator/impl/neomedia/device/Video4Linux2Auto.java index cec10e3..d4d0ad3 100644 --- a/src/net/java/sip/communicator/impl/neomedia/device/Video4Linux2Auto.java +++ b/src/net/java/sip/communicator/impl/neomedia/device/Video4Linux2Auto.java @@ -7,7 +7,6 @@ package net.java.sip.communicator.impl.neomedia.device; import javax.media.*; -import javax.media.format.*; import net.java.sip.communicator.impl.neomedia.codec.*; import net.java.sip.communicator.impl.neomedia.codec.video.*; @@ -18,12 +17,13 @@ import net.java.sip.communicator.util.*; * Discovers and registers <tt>CaptureDevice</tt>s which implement the Video for * Linux Two API Specification with JMF. * - * @author Lubomir Marinov + * @author Lyubomir Marinov */ public class Video4Linux2Auto { /** - * The <tt>Logger</tt>. + * The <tt>Logger</tt> used by the <tt>Video4Linux2Auto</tt> class and its + * instances for logging output. */ private static final Logger logger = Logger.getLogger(Video4Linux2Auto.class); diff --git a/src/net/java/sip/communicator/service/neomedia/SrtpControl.java b/src/net/java/sip/communicator/service/neomedia/SrtpControl.java index d359b94..85ca938 100644 --- a/src/net/java/sip/communicator/service/neomedia/SrtpControl.java +++ b/src/net/java/sip/communicator/service/neomedia/SrtpControl.java @@ -71,10 +71,10 @@ public interface SrtpControl /** * Sets the <tt>RTPConnector</tt> which is to use or uses this SRTP engine. * - * @param newValue the <tt>RTPConnector</tt> which is to use or uses this + * @param connector the <tt>RTPConnector</tt> which is to use or uses this * SRTP engine */ - public void setConnector(AbstractRTPConnector newValue); + public void setConnector(AbstractRTPConnector connector); /** * Indicates if the key exchange method is dependent on secure transport of diff --git a/src/net/java/sip/communicator/service/protocol/media/TransportManager.java b/src/net/java/sip/communicator/service/protocol/media/TransportManager.java index b6aa620..3bdab81 100644 --- a/src/net/java/sip/communicator/service/protocol/media/TransportManager.java +++ b/src/net/java/sip/communicator/service/protocol/media/TransportManager.java @@ -115,31 +115,38 @@ public abstract class TransportManager<U extends MediaAwareCallPeer<?, ?, ?>> public StreamConnector getStreamConnector(MediaType mediaType) throws OperationFailedException { - StreamConnector streamConnector = streamConnectors[mediaType.ordinal()]; + int streamConnectorIndex = mediaType.ordinal(); + StreamConnector streamConnector + = streamConnectors[streamConnectorIndex]; - if(streamConnector == null || streamConnector.getProtocol() == - StreamConnector.Protocol.UDP) + if((streamConnector == null) + || (streamConnector.getProtocol() == StreamConnector.Protocol.UDP)) { - if(streamConnector == null || - streamConnector.getDataSocket().isClosed() || - (streamConnector.getControlSocket() != null && - streamConnector.getControlSocket().isClosed())) - { - streamConnectors[mediaType.ordinal()] - = streamConnector - = createStreamConnector(mediaType); - } + DatagramSocket controlSocket; + + if((streamConnector == null) + || streamConnector.getDataSocket().isClosed() + || (((controlSocket = streamConnector.getControlSocket()) + != null) + && controlSocket.isClosed())) + { + streamConnectors[streamConnectorIndex] + = streamConnector + = createStreamConnector(mediaType); + } } - else if(streamConnector != null && streamConnector.getProtocol() == - StreamConnector.Protocol.TCP) + else if(streamConnector.getProtocol() == StreamConnector.Protocol.TCP) { + Socket controlTCPSocket; + if(streamConnector.getDataTCPSocket().isClosed() - || (streamConnector.getControlTCPSocket() != null && - streamConnector.getControlTCPSocket().isClosed())) + || (((controlTCPSocket = streamConnector.getControlTCPSocket()) + != null) + && controlTCPSocket.isClosed())) { - streamConnectors[mediaType.ordinal()] - = streamConnector - = createStreamConnector(mediaType); + streamConnectors[streamConnectorIndex] + = streamConnector + = createStreamConnector(mediaType); } } return streamConnector; @@ -371,22 +378,32 @@ public abstract class TransportManager<U extends MediaAwareCallPeer<?, ?, ?>> synchronized(connector) { - if(connector.getProtocol() == StreamConnector.Protocol.TCP) + if(connector.getProtocol() != StreamConnector.Protocol.TCP) { - return; - } + DatagramSocket socket; - /* data port (RTP) */ - if(connector.getDataSocket() != null) - connector.getDataSocket().send(new DatagramPacket( - new byte[0], 0, target.getDataAddress().getAddress(), - target.getDataAddress().getPort())); - - /* control port (RTCP) */ - if(connector.getControlSocket() != null) - connector.getControlSocket().send(new DatagramPacket( - new byte[0], 0, target.getControlAddress().getAddress(), - target.getControlAddress().getPort())); + /* data port (RTP) */ + if((socket = connector.getDataSocket()) != null) + { + socket.send( + new DatagramPacket( + new byte[0], + 0, + target.getDataAddress().getAddress(), + target.getDataAddress().getPort())); + } + + /* control port (RTCP) */ + if((socket = connector.getControlSocket()) != null) + { + socket.send( + new DatagramPacket( + new byte[0], + 0, + target.getControlAddress().getAddress(), + target.getControlAddress().getPort())); + } + } } } catch(Exception e) @@ -404,16 +421,15 @@ public abstract class TransportManager<U extends MediaAwareCallPeer<?, ?, ?>> */ protected void setTrafficClass(MediaStreamTarget target, MediaType type) { - int trafficClass = 0; - // get traffic class value for RTP audio/video - trafficClass = getDSCP(type); + int trafficClass = getDSCP(type); if(trafficClass <= 0) return; if (logger.isInfoEnabled()) - logger.info("Set traffic class for " + type + " " + trafficClass); + logger.info( + "Set traffic class for " + type + " to " + trafficClass); try { StreamConnector connector = getStreamConnector(type); @@ -442,40 +458,46 @@ public abstract class TransportManager<U extends MediaAwareCallPeer<?, ?, ?>> } catch(Exception e) { - logger.error("Error cannot send to remote peer", e); + logger.error( + "Failed to set traffic class for " + type + " to " + + trafficClass, + e); } } - /** - * Get the SIP traffic class from configuration. + * Gets the SIP traffic class associated with a specific <tt>MediaType</tt> + * from the configuration. * - * @return SIP traffic class or 0 if not configured + * @param type the <tt>MediaType</tt> to get the associated SIP traffic + * class of + * @return the SIP traffic class associated with the specified + * <tt>MediaType</tt> or <tt>0</tt> if not configured */ private int getDSCP(MediaType type) { - ConfigurationService configService = - ProtocolMediaActivator.getConfigurationService(); - - String dscp = null; - - if(type == MediaType.AUDIO) - dscp = - (String)configService.getProperty( - RTP_AUDIO_DSCP_PROPERTY); - else if(type == MediaType.VIDEO) - dscp = - (String)configService.getProperty( - RTP_VIDEO_DSCP_PROPERTY); - else - return 0; - - if(dscp != null) + String dscpPropertyName; + + switch (type) { - return Integer.parseInt(dscp) << 2; + case AUDIO: + dscpPropertyName = RTP_AUDIO_DSCP_PROPERTY; + break; + case VIDEO: + dscpPropertyName = RTP_VIDEO_DSCP_PROPERTY; + break; + default: + dscpPropertyName = null; + break; } - return 0; + return + (dscpPropertyName == null) + ? 0 + : (ProtocolMediaActivator.getConfigurationService().getInt( + dscpPropertyName, + 0) + << 2); } /** |