mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-09 10:19:41 +02:00
Fix minor codestyle issues
This commit is contained in:
parent
200f90ffdc
commit
cb18056613
422 changed files with 1404 additions and 1444 deletions
|
@ -46,24 +46,24 @@ public class ContentNegotiator extends JingleNegotiator {
|
|||
public static final String INITIATOR = "initiator";
|
||||
public static final String RESPONDER = "responder";
|
||||
|
||||
private List<TransportNegotiator> transportNegotiators;
|
||||
private final List<TransportNegotiator> transportNegotiators;
|
||||
private MediaNegotiator mediaNeg; // The description...
|
||||
private TransportNegotiator transNeg; // and transport negotiators
|
||||
private JingleTransportManager jingleTransportManager;
|
||||
private String creator;
|
||||
private String name;
|
||||
private final String creator;
|
||||
private final String name;
|
||||
private JingleMediaSession jingleMediaSession = null;
|
||||
|
||||
public ContentNegotiator(JingleSession session, String inCreator, String inName) {
|
||||
super(session);
|
||||
creator = inCreator;
|
||||
name = inName;
|
||||
transportNegotiators = new ArrayList<TransportNegotiator>();
|
||||
transportNegotiators = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException, InterruptedException {
|
||||
List<IQ> responses = new ArrayList<IQ>();
|
||||
List<IQ> responses = new ArrayList<>();
|
||||
|
||||
// First only process IQ packets that contain <content> stanzas that
|
||||
// match this media manager.
|
||||
|
@ -203,7 +203,7 @@ public class ContentNegotiator extends JingleNegotiator {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set TransportNegociator
|
||||
* Set TransportNegotiator
|
||||
*
|
||||
* @param transNeg
|
||||
* the transNeg to set
|
||||
|
@ -301,7 +301,7 @@ public class ContentNegotiator extends JingleNegotiator {
|
|||
jingleMediaSession.addMediaReceivedListener(session);
|
||||
if (jingleMediaSession != null) {
|
||||
|
||||
jingleMediaSession.startTrasmit();
|
||||
jingleMediaSession.startTransmit();
|
||||
jingleMediaSession.startReceive();
|
||||
|
||||
for (TransportCandidate candidate : getTransportNegotiator().getOfferedCandidates())
|
||||
|
@ -319,7 +319,7 @@ public class ContentNegotiator extends JingleNegotiator {
|
|||
public void stopJingleMediaSession() {
|
||||
|
||||
if (jingleMediaSession != null) {
|
||||
jingleMediaSession.stopTrasmit();
|
||||
jingleMediaSession.stopTransmit();
|
||||
jingleMediaSession.stopReceive();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public enum JingleActionEnum {
|
|||
|
||||
private final String actionCode;
|
||||
|
||||
private JingleActionEnum(String inActionCode) {
|
||||
JingleActionEnum(String inActionCode) {
|
||||
actionCode = inActionCode;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,14 +59,14 @@ import org.jxmpp.jid.Jid;
|
|||
* <p/>
|
||||
* To create a Jingle Session you need a Transport method and a Payload type.
|
||||
* <p/>
|
||||
* A transport method is how it will trasmit and receive network packets. Transport MUST have one or more candidates.
|
||||
* A transport method is how it will transmit and receive network packets. Transport MUST have one or more candidates.
|
||||
* A transport candidate is an IP Address with a defined port, that other party must send data to.
|
||||
* <p/>
|
||||
* A supported payload type, is the data encoding format that the jmf will be transmitted.
|
||||
* For instance an Audio Payload "GSM".
|
||||
* <p/>
|
||||
* A Jingle session negociates a payload type and a pair of transport candidates.
|
||||
* Which means that when a Jingle Session is establhished you will have two defined transport candidates with addresses
|
||||
* A Jingle session negotiates a payload type and a pair of transport candidates.
|
||||
* Which means that when a Jingle Session is established you will have two defined transport candidates with addresses
|
||||
* and a defined Payload type.
|
||||
* In other words, you will have two IP address with their respective ports, and a Codec type defined.
|
||||
* <p/>
|
||||
|
@ -75,13 +75,13 @@ import org.jxmpp.jid.Jid;
|
|||
* use this class for setting the Jingle parameters, create and receive Jingle Sessions.
|
||||
* <p/>
|
||||
* In order to use the Jingle, the user must provide a
|
||||
* TransportManager that will handle the resolution of potential IP addresses taht can be used to transport the streaming (jmf).
|
||||
* TransportManager that will handle the resolution of potential IP addresses that can be used to transport the streaming (jmf).
|
||||
* This TransportManager can be initialized with several default resolvers,
|
||||
* including a fixed solver that can be used when the address and port are know
|
||||
* in advance.
|
||||
* This API have ready to use Transport Managers, for instance: BasicTransportManager, STUNTransportManager, BridgedTransportManager.
|
||||
* <p/>
|
||||
* You should also especify a JingleMediaManager if you want that JingleManager assume Media control
|
||||
* You should also specify a JingleMediaManager if you want that JingleManager assume Media control
|
||||
* Using a JingleMediaManager implementation is the easier way to implement a Jingle Application.
|
||||
* <p/>
|
||||
* Otherwise before creating an outgoing connection, the user must create jingle session
|
||||
|
@ -192,16 +192,16 @@ public class JingleManager implements JingleSessionListener {
|
|||
|
||||
// non-static
|
||||
|
||||
final List<JingleSession> jingleSessions = new ArrayList<JingleSession>();
|
||||
private final List<JingleSession> jingleSessions = new ArrayList<>();
|
||||
|
||||
// Listeners for manager events (ie, session requests...)
|
||||
private List<JingleSessionRequestListener> jingleSessionRequestListeners;
|
||||
|
||||
// Listeners for created JingleSessions
|
||||
private List<CreatedJingleSessionListener> creationListeners = new ArrayList<CreatedJingleSessionListener>();
|
||||
private final List<CreatedJingleSessionListener> creationListeners = new ArrayList<>();
|
||||
|
||||
// The XMPP connection
|
||||
private XMPPConnection connection;
|
||||
private final XMPPConnection connection;
|
||||
|
||||
// The Media Managers
|
||||
private List<JingleMediaManager> jingleMediaManagers;
|
||||
|
@ -211,7 +211,7 @@ public class JingleManager implements JingleSessionListener {
|
|||
* If a fully implemented JingleMediaSession is entered, JingleManager manage Jingle signalling and jmf
|
||||
*
|
||||
* @param connection XMPP XMPPConnection to be used
|
||||
* @param jingleMediaManagers an implemeted JingleMediaManager to be used.
|
||||
* @param jingleMediaManagers an implemented JingleMediaManager to be used.
|
||||
* @throws SmackException
|
||||
* @throws XMPPException
|
||||
*/
|
||||
|
@ -477,7 +477,7 @@ public class JingleManager implements JingleSessionListener {
|
|||
}
|
||||
};
|
||||
|
||||
jingleSessionRequestListeners = new ArrayList<JingleSessionRequestListener>();
|
||||
jingleSessionRequestListeners = new ArrayList<>();
|
||||
|
||||
// Start a packet listener for session initiation requests
|
||||
connection.addAsyncStanzaListener(new StanzaListener() {
|
||||
|
@ -512,7 +512,7 @@ public class JingleManager implements JingleSessionListener {
|
|||
*/
|
||||
void triggerSessionRequested(Jingle initJin) {
|
||||
|
||||
JingleSessionRequestListener[] jingleSessionRequestListeners = null;
|
||||
JingleSessionRequestListener[] jingleSessionRequestListeners;
|
||||
|
||||
// Make a synchronized copy of the listenerJingles
|
||||
synchronized (this.jingleSessionRequestListeners) {
|
||||
|
@ -537,7 +537,7 @@ public class JingleManager implements JingleSessionListener {
|
|||
* @return The session on which the negotiation can be run.
|
||||
*/
|
||||
public JingleSession createOutgoingJingleSession(EntityFullJid responder) throws XMPPException {
|
||||
JingleSession session = new JingleSession(connection, (JingleSessionRequest) null, connection.getUser(), responder, jingleMediaManagers);
|
||||
JingleSession session = new JingleSession(connection, null, connection.getUser(), responder, jingleMediaManagers);
|
||||
|
||||
triggerSessionCreated(session);
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ public abstract class JingleNegotiator {
|
|||
|
||||
protected JingleSession session;
|
||||
|
||||
private final List<JingleListener> listeners = new ArrayList<JingleListener>();
|
||||
private final List<JingleListener> listeners = new ArrayList<>();
|
||||
|
||||
private String expectedAckId;
|
||||
|
||||
|
@ -158,7 +158,7 @@ public abstract class JingleNegotiator {
|
|||
* @param id
|
||||
*/
|
||||
public void removeExpectedId(String id) {
|
||||
addExpectedId((String) null);
|
||||
addExpectedId(null);
|
||||
}
|
||||
|
||||
// Listeners
|
||||
|
@ -196,7 +196,7 @@ public abstract class JingleNegotiator {
|
|||
ArrayList<JingleListener> result;
|
||||
|
||||
synchronized (listeners) {
|
||||
result = new ArrayList<JingleListener>(listeners);
|
||||
result = new ArrayList<>(listeners);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -67,7 +67,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
private static final Logger LOGGER = Logger.getLogger(JingleSession.class.getName());
|
||||
|
||||
// static
|
||||
private static final HashMap<XMPPConnection, JingleSession> sessions = new HashMap<XMPPConnection, JingleSession>();
|
||||
private static final HashMap<XMPPConnection, JingleSession> sessions = new HashMap<>();
|
||||
|
||||
private static final Random randomGenerator = new Random();
|
||||
|
||||
|
@ -79,23 +79,23 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
|
||||
private String sid; // A unique id that identifies this session
|
||||
|
||||
ConnectionListener connectionListener;
|
||||
private ConnectionListener connectionListener;
|
||||
|
||||
StanzaListener packetListener;
|
||||
private StanzaListener packetListener;
|
||||
|
||||
StanzaFilter packetFilter;
|
||||
private StanzaFilter packetFilter;
|
||||
|
||||
protected List<JingleMediaManager> jingleMediaManagers = null;
|
||||
|
||||
private JingleSessionState sessionState;
|
||||
|
||||
private List<ContentNegotiator> contentNegotiators;
|
||||
private final List<ContentNegotiator> contentNegotiators;
|
||||
|
||||
private XMPPConnection connection;
|
||||
private final XMPPConnection connection;
|
||||
|
||||
private String sessionInitPacketID;
|
||||
|
||||
private Map<String, JingleMediaSession> mediaSessionMap;
|
||||
private final Map<String, JingleMediaSession> mediaSessionMap;
|
||||
|
||||
/**
|
||||
* Full featured JingleSession constructor.
|
||||
|
@ -125,10 +125,10 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
// Initially, we don't known the session state.
|
||||
setSessionState(JingleSessionStateUnknown.getInstance());
|
||||
|
||||
contentNegotiators = new ArrayList<ContentNegotiator>();
|
||||
mediaSessionMap = new HashMap<String, JingleMediaSession>();
|
||||
contentNegotiators = new ArrayList<>();
|
||||
mediaSessionMap = new HashMap<>();
|
||||
|
||||
// Add the session to the list and register the listeneres
|
||||
// Add the session to the list and register the listeners
|
||||
registerInstance();
|
||||
installConnectionListeners(conn);
|
||||
}
|
||||
|
@ -284,9 +284,9 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
* @throws InterruptedException
|
||||
*/
|
||||
public synchronized void receivePacketAndRespond(IQ iq) throws XMPPException, SmackException, InterruptedException {
|
||||
List<IQ> responses = new ArrayList<IQ>();
|
||||
List<IQ> responses = new ArrayList<>();
|
||||
|
||||
String responseId = null;
|
||||
String responseId;
|
||||
|
||||
LOGGER.fine("Packet: " + iq.toXML());
|
||||
|
||||
|
@ -355,7 +355,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
*/
|
||||
@Override
|
||||
public List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException, InterruptedException {
|
||||
List<IQ> responses = new ArrayList<IQ>();
|
||||
List<IQ> responses = new ArrayList<>();
|
||||
IQ response = null;
|
||||
|
||||
if (iq != null) {
|
||||
|
@ -437,7 +437,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
* incoming packet.
|
||||
*
|
||||
* @param iq
|
||||
* The Jingle stanza(/packet) we are responing to
|
||||
* The Jingle stanza(/packet) we are responding to
|
||||
* @param jout
|
||||
* the Jingle stanza(/packet) we want to complete and send
|
||||
* @throws NotConnectedException
|
||||
|
@ -1041,11 +1041,11 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
|
||||
/**
|
||||
* Complete and send an error. Complete all the null fields in an IQ error
|
||||
* reponse, using the sesssion information we have or some info from the
|
||||
* response, using the session information we have or some info from the
|
||||
* incoming packet.
|
||||
*
|
||||
* @param iq
|
||||
* The Jingle stanza(/packet) we are responing to
|
||||
* The Jingle stanza(/packet) we are responding to
|
||||
* @param jingleError
|
||||
* the IQ stanza(/packet) we want to complete and send
|
||||
*/
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.jxmpp.jid.Jid;
|
|||
* <p/>
|
||||
* This class is a facade of a received Jingle request. The user can have direct
|
||||
* access to the Jingle stanza(/packet) (<i>JingleSessionRequest.getJingle() </i>) of
|
||||
* the request or can use the convencience methods provided by this class.
|
||||
* the request or can use the convenience methods provided by this class.
|
||||
*
|
||||
* @author Alvaro Saurin
|
||||
*/
|
||||
|
@ -46,11 +46,11 @@ public class JingleSessionRequest {
|
|||
// request
|
||||
|
||||
/**
|
||||
* A recieve request is constructed from the Jingle Initiation request
|
||||
* received from the initator.
|
||||
* A receive request is constructed from the Jingle Initiation request
|
||||
* received from the initiator.
|
||||
*
|
||||
* @param manager The manager handling this request
|
||||
* @param jingle The jingle IQ recieved from the initiator.
|
||||
* @param jingle The jingle IQ received from the initiator.
|
||||
*/
|
||||
public JingleSessionRequest(JingleManager manager, Jingle jingle) {
|
||||
this.manager = manager;
|
||||
|
@ -113,7 +113,7 @@ public class JingleSessionRequest {
|
|||
* @throws InterruptedException
|
||||
*/
|
||||
public synchronized JingleSession accept() throws XMPPException, SmackException, InterruptedException {
|
||||
JingleSession session = null;
|
||||
JingleSession session;
|
||||
synchronized (manager) {
|
||||
session = manager.createIncomingJingleSession(this);
|
||||
// Acknowledge the IQ reception
|
||||
|
@ -129,7 +129,7 @@ public class JingleSessionRequest {
|
|||
* Rejects the session request.
|
||||
*/
|
||||
public synchronized void reject() {
|
||||
JingleSession session = null;
|
||||
JingleSession session;
|
||||
synchronized (manager) {
|
||||
try {
|
||||
session = manager.createIncomingJingleSession(this);
|
||||
|
|
|
@ -68,7 +68,7 @@ public class JingleSessionStateEnded extends JingleSessionState {
|
|||
*/
|
||||
@Override
|
||||
public IQ processJingle(JingleSession session, Jingle jingle, JingleActionEnum action) {
|
||||
IQ response = null;
|
||||
IQ response;
|
||||
|
||||
response = session.createJingleError(jingle, JingleError.MALFORMED_STANZA);
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public class JingleSessionStateUnknown extends JingleSessionState {
|
|||
|
||||
@Override
|
||||
public IQ processJingle(JingleSession session, Jingle jingle, JingleActionEnum action) throws SmackException, InterruptedException {
|
||||
IQ response = null;
|
||||
IQ response;
|
||||
|
||||
switch (action) {
|
||||
case SESSION_INITIATE:
|
||||
|
@ -103,7 +103,7 @@ public class JingleSessionStateUnknown extends JingleSessionState {
|
|||
|
||||
private IQ receiveSessionInitiateAction(JingleSession session, Jingle inJingle) throws SmackException, InterruptedException {
|
||||
|
||||
IQ response = null;
|
||||
IQ response;
|
||||
boolean shouldAck = true;
|
||||
|
||||
// According to XEP-166 when we get a session-initiate we need to check for:
|
||||
|
|
|
@ -25,6 +25,6 @@ import org.jivesoftware.smackx.jingleold.JingleSession;
|
|||
*/
|
||||
public interface CreatedJingleSessionListener {
|
||||
|
||||
public void sessionCreated(JingleSession jingleSession);
|
||||
void sessionCreated(JingleSession jingleSession);
|
||||
|
||||
}
|
||||
|
|
|
@ -24,25 +24,25 @@ public interface JingleMediaInfoListener extends JingleListener {
|
|||
/**
|
||||
* The other end is busy.
|
||||
*/
|
||||
public void mediaInfoBusy();
|
||||
void mediaInfoBusy();
|
||||
|
||||
/**
|
||||
* We are on hold.
|
||||
*/
|
||||
public void mediaInfoHold();
|
||||
void mediaInfoHold();
|
||||
|
||||
/**
|
||||
* The jmf is muted.
|
||||
*/
|
||||
public void mediaInfoMute();
|
||||
void mediaInfoMute();
|
||||
|
||||
/**
|
||||
* We are queued.
|
||||
*/
|
||||
public void mediaInfoQueued();
|
||||
void mediaInfoQueued();
|
||||
|
||||
/**
|
||||
* We are ringing.
|
||||
*/
|
||||
public void mediaInfoRinging();
|
||||
void mediaInfoRinging();
|
||||
}
|
||||
|
|
|
@ -33,12 +33,12 @@ public interface JingleMediaListener extends JingleListener {
|
|||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void mediaEstablished(PayloadType pt) throws NotConnectedException, InterruptedException;
|
||||
void mediaEstablished(PayloadType pt) throws NotConnectedException, InterruptedException;
|
||||
|
||||
/**
|
||||
* Notification that a payload type must be cancelled.
|
||||
*
|
||||
* @param cand The payload type that must be closed
|
||||
*/
|
||||
public void mediaClosed(PayloadType cand);
|
||||
void mediaClosed(PayloadType cand);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public interface JingleSessionListener extends JingleListener {
|
|||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void sessionEstablished(PayloadType pt, TransportCandidate remoteCandidate,
|
||||
void sessionEstablished(PayloadType pt, TransportCandidate remoteCandidate,
|
||||
TransportCandidate localCandidate, JingleSession jingleSession) throws NotConnectedException, InterruptedException;
|
||||
|
||||
/**
|
||||
|
@ -49,7 +49,7 @@ public interface JingleSessionListener extends JingleListener {
|
|||
* @param reason the reason (if any).
|
||||
* @param jingleSession Session that called the method
|
||||
*/
|
||||
public void sessionDeclined(String reason, JingleSession jingleSession);
|
||||
void sessionDeclined(String reason, JingleSession jingleSession);
|
||||
|
||||
/**
|
||||
* Notification that the session was redirected.
|
||||
|
@ -57,7 +57,7 @@ public interface JingleSessionListener extends JingleListener {
|
|||
* @param redirection
|
||||
* @param jingleSession session that called the method
|
||||
*/
|
||||
public void sessionRedirected(String redirection, JingleSession jingleSession);
|
||||
void sessionRedirected(String redirection, JingleSession jingleSession);
|
||||
|
||||
/**
|
||||
* Notification that the session was closed normally.
|
||||
|
@ -65,7 +65,7 @@ public interface JingleSessionListener extends JingleListener {
|
|||
* @param reason the reason (if any).
|
||||
* @param jingleSession Session that called the method
|
||||
*/
|
||||
public void sessionClosed(String reason, JingleSession jingleSession);
|
||||
void sessionClosed(String reason, JingleSession jingleSession);
|
||||
|
||||
/**
|
||||
* Notification that the session was closed due to an exception.
|
||||
|
@ -73,7 +73,7 @@ public interface JingleSessionListener extends JingleListener {
|
|||
* @param e the exception.
|
||||
* @param jingleSession session that called the method
|
||||
*/
|
||||
public void sessionClosedOnError(XMPPException e, JingleSession jingleSession);
|
||||
void sessionClosedOnError(XMPPException e, JingleSession jingleSession);
|
||||
|
||||
/**
|
||||
* Notification that the Media has arrived for this session.
|
||||
|
@ -81,6 +81,6 @@ public interface JingleSessionListener extends JingleListener {
|
|||
* @param jingleSession session that called the method
|
||||
* @param participant description of the participant
|
||||
*/
|
||||
public void sessionMediaReceived(JingleSession jingleSession, String participant);
|
||||
void sessionMediaReceived(JingleSession jingleSession, String participant);
|
||||
|
||||
}
|
||||
|
|
|
@ -25,9 +25,9 @@ import org.jivesoftware.smackx.jingleold.JingleSessionRequest;
|
|||
*/
|
||||
public interface JingleSessionRequestListener extends JingleListener {
|
||||
/**
|
||||
* A request to start a session has been recieved from another user.
|
||||
* A request to start a session has been received from another user.
|
||||
*
|
||||
* @param request The request from the other user.
|
||||
*/
|
||||
public void sessionRequested(JingleSessionRequest request);
|
||||
void sessionRequested(JingleSessionRequest request);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public interface JingleTransportListener extends JingleListener {
|
|||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void transportEstablished(TransportCandidate local,
|
||||
void transportEstablished(TransportCandidate local,
|
||||
TransportCandidate remote) throws NotConnectedException, InterruptedException;
|
||||
|
||||
/**
|
||||
|
@ -47,13 +47,13 @@ public interface JingleTransportListener extends JingleListener {
|
|||
* @param cand The transport candidate that must be cancelled. A value
|
||||
* of "null" means all the transports for this session.
|
||||
*/
|
||||
public void transportClosed(TransportCandidate cand);
|
||||
void transportClosed(TransportCandidate cand);
|
||||
|
||||
/**
|
||||
* Notification that the transport was closed due to an exception.
|
||||
*
|
||||
* @param e the exception.
|
||||
*/
|
||||
public void transportClosedOnError(XMPPException e);
|
||||
void transportClosedOnError(XMPPException e);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ public abstract class JingleMediaManager {
|
|||
public static final String MEDIA_NAME = "JingleMediaManager";
|
||||
|
||||
// Each media manager must keep track of the transport manager that it uses.
|
||||
private JingleTransportManager transportManager;
|
||||
private final JingleTransportManager transportManager;
|
||||
|
||||
public JingleMediaManager(JingleTransportManager transportManager) {
|
||||
this.transportManager = transportManager;
|
||||
|
|
|
@ -45,14 +45,14 @@ public abstract class JingleMediaSession {
|
|||
// Media Locator
|
||||
private String mediaLocator;
|
||||
// Media Received Listener
|
||||
private List<MediaReceivedListener> mediaReceivedListeners = new ArrayList<MediaReceivedListener>();
|
||||
private List<MediaReceivedListener> mediaReceivedListeners = new ArrayList<>();
|
||||
// Jingle Session
|
||||
private JingleSession jingleSession;
|
||||
|
||||
/**
|
||||
* Creates a new JingleMediaSession Instance to handle Media methods.
|
||||
*
|
||||
* @param payloadType Payload Type of the transmittion
|
||||
* @param payloadType Payload Type of the transmission
|
||||
* @param remote Remote accepted Transport Candidate
|
||||
* @param local Local accepted Transport Candidate
|
||||
* @param mediaLocator Media Locator of the capture device
|
||||
|
@ -144,7 +144,7 @@ public abstract class JingleMediaSession {
|
|||
/**
|
||||
* Starts a RTP / UDP / TCP Transmission to the remote Candidate.
|
||||
*/
|
||||
public abstract void startTrasmit();
|
||||
public abstract void startTransmit();
|
||||
|
||||
/**
|
||||
* Starts a RTP / UDP / TCP Receiver from the remote Candidate to local Candidate.
|
||||
|
@ -157,12 +157,12 @@ public abstract class JingleMediaSession {
|
|||
*
|
||||
* @param active
|
||||
*/
|
||||
public abstract void setTrasmit(boolean active);
|
||||
public abstract void setTransmit(boolean active);
|
||||
|
||||
/**
|
||||
* Stops a RTP / UDP / TCP Transmission to the remote Candidate.
|
||||
*/
|
||||
public abstract void stopTrasmit();
|
||||
public abstract void stopTransmit();
|
||||
|
||||
/**
|
||||
* Stops a RTP / UDP / TCP Receiver from the remote Candidate to local Candidate.
|
||||
|
|
|
@ -55,9 +55,9 @@ public class MediaNegotiator extends JingleNegotiator {
|
|||
|
||||
// Local and remote payload types...
|
||||
|
||||
private final List<PayloadType> localAudioPts = new ArrayList<PayloadType>();
|
||||
private final List<PayloadType> localAudioPts = new ArrayList<>();
|
||||
|
||||
private final List<PayloadType> remoteAudioPts = new ArrayList<PayloadType>();
|
||||
private final List<PayloadType> remoteAudioPts = new ArrayList<>();
|
||||
|
||||
private PayloadType bestCommonAudioPt;
|
||||
|
||||
|
@ -108,7 +108,7 @@ public class MediaNegotiator extends JingleNegotiator {
|
|||
*/
|
||||
@Override
|
||||
public List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, NotConnectedException, InterruptedException {
|
||||
List<IQ> responses = new ArrayList<IQ>();
|
||||
List<IQ> responses = new ArrayList<>();
|
||||
IQ response = null;
|
||||
|
||||
if (iq.getType().equals(IQ.Type.error)) {
|
||||
|
@ -185,7 +185,7 @@ public class MediaNegotiator extends JingleNegotiator {
|
|||
// // Calculate the best common codec
|
||||
// bestCommonAudioPt = calculateBestCommonAudioPt(remoteAudioPts);
|
||||
//
|
||||
// // and send an accept if we havee an agreement...
|
||||
// // and send an accept if we have an agreement...
|
||||
// if (bestCommonAudioPt != null) {
|
||||
// response = createAcceptMessage();
|
||||
// } else {
|
||||
|
@ -208,10 +208,9 @@ public class MediaNegotiator extends JingleNegotiator {
|
|||
* @throws InterruptedException
|
||||
*/
|
||||
private IQ receiveContentAcceptAction(Jingle jingle, JingleDescription description) throws XMPPException, NotConnectedException, InterruptedException {
|
||||
IQ response = null;
|
||||
List<PayloadType> offeredPayloads = new ArrayList<PayloadType>();
|
||||
IQ response;
|
||||
|
||||
offeredPayloads = description.getAudioPayloadTypesList();
|
||||
List<PayloadType> offeredPayloads = description.getAudioPayloadTypesList();
|
||||
bestCommonAudioPt = calculateBestCommonAudioPt(offeredPayloads);
|
||||
|
||||
if (bestCommonAudioPt == null) {
|
||||
|
@ -240,9 +239,7 @@ public class MediaNegotiator extends JingleNegotiator {
|
|||
private IQ receiveSessionInitiateAction(Jingle jingle, JingleDescription description) {
|
||||
IQ response = null;
|
||||
|
||||
List<PayloadType> offeredPayloads = new ArrayList<PayloadType>();
|
||||
|
||||
offeredPayloads = description.getAudioPayloadTypesList();
|
||||
List<PayloadType> offeredPayloads = description.getAudioPayloadTypesList();
|
||||
bestCommonAudioPt = calculateBestCommonAudioPt(offeredPayloads);
|
||||
|
||||
synchronized (remoteAudioPts) {
|
||||
|
@ -251,7 +248,7 @@ public class MediaNegotiator extends JingleNegotiator {
|
|||
|
||||
// If there are suitable/matching payload types then accept this content.
|
||||
if (bestCommonAudioPt != null) {
|
||||
// Let thre transport negotiators sort-out connectivity and content-accept instead.
|
||||
// Let the transport negotiators sort-out connectivity and content-accept instead.
|
||||
// response = createAudioPayloadTypesOffer();
|
||||
setNegotiatorState(JingleNegotiatorState.PENDING);
|
||||
} else {
|
||||
|
@ -266,7 +263,7 @@ public class MediaNegotiator extends JingleNegotiator {
|
|||
* A content info has been received. This is done for publishing the
|
||||
* list of payload types...
|
||||
*
|
||||
* @param jin
|
||||
* @param jingle
|
||||
* The input packet
|
||||
* @return a Jingle packet
|
||||
* @throws JingleException
|
||||
|
@ -314,7 +311,6 @@ public class MediaNegotiator extends JingleNegotiator {
|
|||
private IQ receiveSessionAcceptAction(Jingle jingle, JingleDescription description) throws JingleException {
|
||||
IQ response = null;
|
||||
PayloadType.Audio agreedCommonAudioPt;
|
||||
List<PayloadType> offeredPayloads = new ArrayList<PayloadType>();
|
||||
|
||||
if (bestCommonAudioPt == null) {
|
||||
// Update the best common audio PT
|
||||
|
@ -322,7 +318,7 @@ public class MediaNegotiator extends JingleNegotiator {
|
|||
// response = createAcceptMessage();
|
||||
}
|
||||
|
||||
offeredPayloads = description.getAudioPayloadTypesList();
|
||||
List<PayloadType> offeredPayloads = description.getAudioPayloadTypesList();
|
||||
if (!offeredPayloads.isEmpty()) {
|
||||
if (offeredPayloads.size() == 1) {
|
||||
agreedCommonAudioPt = (PayloadType.Audio) offeredPayloads.get(0);
|
||||
|
@ -363,8 +359,8 @@ public class MediaNegotiator extends JingleNegotiator {
|
|||
// Payload types
|
||||
|
||||
private PayloadType calculateBestCommonAudioPt(List<PayloadType> remoteAudioPts) {
|
||||
final ArrayList<PayloadType> commonAudioPtsHere = new ArrayList<PayloadType>();
|
||||
final ArrayList<PayloadType> commonAudioPtsThere = new ArrayList<PayloadType>();
|
||||
final ArrayList<PayloadType> commonAudioPtsHere = new ArrayList<>();
|
||||
final ArrayList<PayloadType> commonAudioPtsThere = new ArrayList<>();
|
||||
PayloadType result = null;
|
||||
|
||||
if (!remoteAudioPts.isEmpty()) {
|
||||
|
|
|
@ -24,6 +24,6 @@ public interface MediaReceivedListener {
|
|||
/**
|
||||
* Called when new Media is received.
|
||||
*/
|
||||
public void mediaReceived(String participant);
|
||||
void mediaReceived(String participant);
|
||||
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ public class PayloadType {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the numer of channels for a payload type.
|
||||
* Set the number of channels for a payload type.
|
||||
*
|
||||
* @param channels The number of channels
|
||||
*/
|
||||
|
|
|
@ -250,7 +250,7 @@ public class JMFInit extends Frame implements Runnable {
|
|||
plType);
|
||||
int listSize = rendList.size();
|
||||
boolean found = false;
|
||||
String rname = null;
|
||||
String rname;
|
||||
|
||||
for (int i = 0; i < listSize; i++) {
|
||||
rname = rendList.elementAt(i);
|
||||
|
|
|
@ -63,7 +63,7 @@ import org.jivesoftware.smackx.jingleold.media.JingleMediaSession;
|
|||
* Receiving
|
||||
* portB ---> portA
|
||||
* <p/>
|
||||
* <i>Transmit and Receive are interdependents. To receive you MUST trasmit. </i>
|
||||
* <i>Transmit and Receive are interdependence. To receive you MUST transmit. </i>
|
||||
*
|
||||
* @author Thiago Camargo
|
||||
*/
|
||||
|
@ -83,7 +83,7 @@ public class AudioChannel {
|
|||
private DataSource dataOutput = null;
|
||||
private AudioReceiver audioReceiver;
|
||||
|
||||
private List<SendStream> sendStreams = new ArrayList<SendStream>();
|
||||
private List<SendStream> sendStreams = new ArrayList<>();
|
||||
|
||||
private JingleMediaSession jingleMediaSession;
|
||||
|
||||
|
@ -220,7 +220,7 @@ public class AudioChannel {
|
|||
// Get the tracks from the processor
|
||||
TrackControl[] tracks = processor.getTrackControls();
|
||||
|
||||
// Do we have atleast one track?
|
||||
// Do we have at least one track?
|
||||
if (tracks == null || tracks.length < 1) {
|
||||
return "Couldn't find tracks in processor";
|
||||
}
|
||||
|
@ -404,7 +404,7 @@ public class AudioChannel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set transmit activity. If the active is true, the instance should trasmit.
|
||||
* Set transmit activity. If the active is true, the instance should transmit.
|
||||
* If it is set to false, the instance should pause transmit.
|
||||
*
|
||||
* @param active active state
|
||||
|
|
|
@ -30,8 +30,8 @@ import org.jivesoftware.smackx.jingleold.nat.TransportCandidate;
|
|||
|
||||
/**
|
||||
* This Class implements a complete JingleMediaSession.
|
||||
* It sould be used to transmit and receive audio captured from the Mic.
|
||||
* This Class should be automaticly controlled by JingleSession.
|
||||
* It should be used to transmit and receive audio captured from the Mic.
|
||||
* This Class should be automatically controlled by JingleSession.
|
||||
* But you could also use in any VOIP application.
|
||||
* For better NAT Traversal support this implementation don't support only receive or only transmit.
|
||||
* To receive you MUST transmit. So the only implemented and functionally methods are startTransmit() and stopTransmit()
|
||||
|
@ -92,7 +92,7 @@ public class AudioMediaSession extends JingleMediaSession {
|
|||
* Starts transmission and for NAT Traversal reasons start receiving also.
|
||||
*/
|
||||
@Override
|
||||
public void startTrasmit() {
|
||||
public void startTransmit() {
|
||||
audioChannel.start();
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ public class AudioMediaSession extends JingleMediaSession {
|
|||
* @param active active state
|
||||
*/
|
||||
@Override
|
||||
public void setTrasmit(boolean active) {
|
||||
public void setTransmit(boolean active) {
|
||||
audioChannel.setTrasmit(active);
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ public class AudioMediaSession extends JingleMediaSession {
|
|||
* Stops transmission and for NAT Traversal reasons stop receiving also.
|
||||
*/
|
||||
@Override
|
||||
public void stopTrasmit() {
|
||||
public void stopTransmit() {
|
||||
if (audioChannel != null)
|
||||
audioChannel.stop();
|
||||
}
|
||||
|
|
|
@ -93,10 +93,10 @@ public class AudioReceiver implements ReceiveStreamListener, SessionListener,
|
|||
// Find out the formats.
|
||||
RTPControl ctl = (RTPControl) ds.getControl("javax.jmf.rtp.RTPControl");
|
||||
if (ctl != null) {
|
||||
LOGGER.severe(" - Recevied new RTP stream: " + ctl.getFormat());
|
||||
LOGGER.severe(" - Received new RTP stream: " + ctl.getFormat());
|
||||
}
|
||||
else
|
||||
LOGGER.severe(" - Recevied new RTP stream");
|
||||
LOGGER.severe(" - Received new RTP stream");
|
||||
|
||||
if (participant == null)
|
||||
LOGGER.severe(" The sender of this stream had yet to be identified.");
|
||||
|
@ -113,7 +113,7 @@ public class AudioReceiver implements ReceiveStreamListener, SessionListener,
|
|||
p.realize();
|
||||
jingleMediaSession.mediaReceived(participant != null ? participant.getCNAME() : "");
|
||||
|
||||
// Notify intialize() that a new stream had arrived.
|
||||
// Notify initialize() that a new stream had arrived.
|
||||
synchronized (dataSync) {
|
||||
dataReceived = true;
|
||||
dataSync.notifyAll();
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.jivesoftware.smackx.jingleold.nat.TransportCandidate;
|
|||
|
||||
/**
|
||||
* Implements a jingleMediaManager using JMF based API.
|
||||
* It supports GSM and G723 codecs.
|
||||
* It supports GSM and G723 codices.
|
||||
* <i>This API only currently works on windows and Mac.</i>
|
||||
*
|
||||
* @author Thiago Camargo
|
||||
|
@ -45,7 +45,7 @@ public class JmfMediaManager extends JingleMediaManager {
|
|||
public static final String MEDIA_NAME = "JMF";
|
||||
|
||||
|
||||
private List<PayloadType> payloads = new ArrayList<PayloadType>();
|
||||
private List<PayloadType> payloads = new ArrayList<>();
|
||||
private String mediaLocator = null;
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,8 +41,8 @@ import mil.jfcom.cie.media.srtp.packetizer.SpeexFormat;
|
|||
|
||||
/**
|
||||
* This Class implements a complete JingleMediaSession.
|
||||
* It sould be used to transmit and receive audio captured from the Mic.
|
||||
* This Class should be automaticly controlled by JingleSession.
|
||||
* It should be used to transmit and receive audio captured from the Mic.
|
||||
* This Class should be automatically controlled by JingleSession.
|
||||
* But you could also use in any VOIP application.
|
||||
* For better NAT Traversal support this implementation don't support only receive or only transmit.
|
||||
* To receive you MUST transmit. So the only implemented and functionally methods are startTransmit() and stopTransmit()
|
||||
|
@ -157,7 +157,7 @@ public class AudioMediaSession extends JingleMediaSession implements MediaSessio
|
|||
* Starts transmission and for NAT Traversal reasons start receiving also.
|
||||
*/
|
||||
@Override
|
||||
public void startTrasmit() {
|
||||
public void startTransmit() {
|
||||
try {
|
||||
LOGGER.fine("start");
|
||||
mediaSession.start(true);
|
||||
|
@ -169,13 +169,13 @@ public class AudioMediaSession extends JingleMediaSession implements MediaSessio
|
|||
}
|
||||
|
||||
/**
|
||||
* Set transmit activity. If the active is true, the instance should trasmit.
|
||||
* Set transmit activity. If the active is true, the instance should transmit.
|
||||
* If it is set to false, the instance should pause transmit.
|
||||
*
|
||||
* @param active active state
|
||||
*/
|
||||
@Override
|
||||
public void setTrasmit(boolean active) {
|
||||
public void setTransmit(boolean active) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ public class AudioMediaSession extends JingleMediaSession implements MediaSessio
|
|||
* Stops transmission and for NAT Traversal reasons stop receiving also.
|
||||
*/
|
||||
@Override
|
||||
public void stopTrasmit() {
|
||||
public void stopTransmit() {
|
||||
if (mediaSession != null)
|
||||
mediaSession.close();
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public class SpeexMediaManager extends JingleMediaManager {
|
|||
|
||||
public static final String MEDIA_NAME = "Speex";
|
||||
|
||||
private List<PayloadType> payloads = new ArrayList<PayloadType>();
|
||||
private List<PayloadType> payloads = new ArrayList<>();
|
||||
|
||||
public SpeexMediaManager(JingleTransportManager transportManager) {
|
||||
super(transportManager);
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.jivesoftware.smackx.jingleold.nat.TransportCandidate;
|
|||
|
||||
/**
|
||||
* Implements a MultiMediaManager using other JingleMediaManager implementations.
|
||||
* It supports every Codecs that JingleMediaManagers added has.
|
||||
* It supports every Codec that JingleMediaManagers added has.
|
||||
*
|
||||
* @author Thiago Camargo
|
||||
*/
|
||||
|
@ -37,7 +37,7 @@ public class MultiMediaManager extends JingleMediaManager {
|
|||
|
||||
public static final String MEDIA_NAME = "Multi";
|
||||
|
||||
private List<JingleMediaManager> managers = new ArrayList<JingleMediaManager>();
|
||||
private static final List<JingleMediaManager> managers = new ArrayList<>();
|
||||
|
||||
private PayloadType preferredPayloadType = null;
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class MultiMediaManager extends JingleMediaManager {
|
|||
*/
|
||||
@Override
|
||||
public List<PayloadType> getPayloads() {
|
||||
List<PayloadType> list = new ArrayList<PayloadType>();
|
||||
List<PayloadType> list = new ArrayList<>();
|
||||
if (preferredPayloadType != null) list.add(preferredPayloadType);
|
||||
for (JingleMediaManager manager : managers) {
|
||||
for (PayloadType payloadType : manager.getPayloads()) {
|
||||
|
|
|
@ -39,7 +39,7 @@ public class ScreenShareMediaManager extends JingleMediaManager {
|
|||
|
||||
public static final String MEDIA_NAME = "ScreenShare";
|
||||
|
||||
private List<PayloadType> payloads = new ArrayList<PayloadType>();
|
||||
private List<PayloadType> payloads = new ArrayList<>();
|
||||
|
||||
private ImageDecoder decoder = null;
|
||||
private ImageEncoder encoder = null;
|
||||
|
|
|
@ -41,8 +41,8 @@ import org.jivesoftware.smackx.jingleold.nat.TransportCandidate;
|
|||
|
||||
/**
|
||||
* This Class implements a complete JingleMediaSession.
|
||||
* It sould be used to transmit and receive captured images from the Display.
|
||||
* This Class should be automaticly controlled by JingleSession.
|
||||
* It should be used to transmit and receive captured images from the Display.
|
||||
* This Class should be automatically controlled by JingleSession.
|
||||
* For better NAT Traversal support this implementation don't support only receive or only transmit.
|
||||
* To receive you MUST transmit. So the only implemented and functionally methods are startTransmit() and stopTransmit()
|
||||
*
|
||||
|
@ -123,18 +123,18 @@ public class ScreenShareSession extends JingleMediaSession {
|
|||
* Starts transmission and for NAT Traversal reasons start receiving also.
|
||||
*/
|
||||
@Override
|
||||
public void startTrasmit() {
|
||||
public void startTransmit() {
|
||||
new Thread(transmitter).start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set transmit activity. If the active is true, the instance should trasmit.
|
||||
* Set transmit activity. If the active is true, the instance should transmit.
|
||||
* If it is set to false, the instance should pause transmit.
|
||||
*
|
||||
* @param active active state
|
||||
*/
|
||||
@Override
|
||||
public void setTrasmit(boolean active) {
|
||||
public void setTransmit(boolean active) {
|
||||
transmitter.setTransmit(true);
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ public class ScreenShareSession extends JingleMediaSession {
|
|||
* Stops transmission and for NAT Traversal reasons stop receiving also.
|
||||
*/
|
||||
@Override
|
||||
public void stopTrasmit() {
|
||||
public void stopTransmit() {
|
||||
if (transmitter != null) {
|
||||
transmitter.stop();
|
||||
}
|
||||
|
|
|
@ -60,8 +60,8 @@ public abstract class AbstractBufferedImageOp implements BufferedImageOp, Clonea
|
|||
* @param image a BufferedImage object
|
||||
* @param x the left edge of the pixel block
|
||||
* @param y the right edge of the pixel block
|
||||
* @param width the width of the pixel arry
|
||||
* @param height the height of the pixel arry
|
||||
* @param width the width of the pixel array
|
||||
* @param height the height of the pixel array
|
||||
* @param pixels the array to hold the returned pixels. May be null.
|
||||
* @return the pixels
|
||||
* @see #setRGB
|
||||
|
@ -79,8 +79,8 @@ public abstract class AbstractBufferedImageOp implements BufferedImageOp, Clonea
|
|||
* @param image a BufferedImage object
|
||||
* @param x the left edge of the pixel block
|
||||
* @param y the right edge of the pixel block
|
||||
* @param width the width of the pixel arry
|
||||
* @param height the height of the pixel arry
|
||||
* @param width the width of the pixel array
|
||||
* @param height the height of the pixel array
|
||||
* @param pixels the array of pixels to set
|
||||
* @see #getRGB
|
||||
*/
|
||||
|
|
|
@ -27,5 +27,5 @@ import java.io.IOException;
|
|||
*/
|
||||
public interface ImageDecoder {
|
||||
|
||||
public BufferedImage decode(ByteArrayInputStream stream) throws IOException;
|
||||
BufferedImage decode(ByteArrayInputStream stream) throws IOException;
|
||||
}
|
||||
|
|
|
@ -25,5 +25,5 @@ import java.io.ByteArrayOutputStream;
|
|||
* @author Thiago Rocha Camargo
|
||||
*/
|
||||
public interface ImageEncoder {
|
||||
public ByteArrayOutputStream encode(BufferedImage bufferedImage);
|
||||
ByteArrayOutputStream encode(BufferedImage bufferedImage);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class OctTreeQuantizer implements Quantizer {
|
|||
final static int MAX_LEVEL = 5;
|
||||
|
||||
/**
|
||||
* An Octtree node.
|
||||
* An Octree node.
|
||||
*/
|
||||
static class OctTreeNode {
|
||||
int children;
|
||||
|
@ -73,7 +73,7 @@ public class OctTreeQuantizer implements Quantizer {
|
|||
private int reduceColors;
|
||||
private int maximumColors;
|
||||
private int colors = 0;
|
||||
private List<Vector<OctTreeNode>> colorList;
|
||||
private final List<Vector<OctTreeNode>> colorList;
|
||||
|
||||
public OctTreeQuantizer() {
|
||||
setup(256);
|
||||
|
|
|
@ -26,7 +26,7 @@ public interface Quantizer {
|
|||
* Initialize the quantizer. This should be called before adding any pixels.
|
||||
* @param numColors the number of colors we're quantizing to.
|
||||
*/
|
||||
public void setup(int numColors);
|
||||
void setup(int numColors);
|
||||
|
||||
/**
|
||||
* Add pixels to the quantizer.
|
||||
|
@ -34,13 +34,13 @@ public interface Quantizer {
|
|||
* @param offset the offset into the array
|
||||
* @param count the count of pixels
|
||||
*/
|
||||
public void addPixels(int[] pixels, int offset, int count);
|
||||
void addPixels(int[] pixels, int offset, int count);
|
||||
|
||||
/**
|
||||
* Build a color table from the added pixels.
|
||||
* @return an array of ARGB pixels representing a color table
|
||||
*/
|
||||
public int[] buildColorTable();
|
||||
int[] buildColorTable();
|
||||
|
||||
/**
|
||||
* Using the previously-built color table, return the index into that table for a pixel.
|
||||
|
@ -49,5 +49,5 @@ public interface Quantizer {
|
|||
* @param rgb the pixel to find
|
||||
* @return the pixel's index in the color table
|
||||
*/
|
||||
public int getIndexForColor(int rgb);
|
||||
int getIndexForColor(int rgb);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public class TestMediaManager extends JingleMediaManager {
|
|||
|
||||
public static final String MEDIA_NAME = "TestMedia";
|
||||
|
||||
private List<PayloadType> payloads = new ArrayList<PayloadType>();
|
||||
private List<PayloadType> payloads = new ArrayList<>();
|
||||
|
||||
private PayloadType preferredPayloadType = null;
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class TestMediaManager extends JingleMediaManager {
|
|||
@Override
|
||||
public JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote,
|
||||
final TransportCandidate local, final JingleSession jingleSession) {
|
||||
TestMediaSession session = null;
|
||||
TestMediaSession session;
|
||||
|
||||
session = new TestMediaSession(payloadType, remote, local, "", jingleSession);
|
||||
|
||||
|
|
|
@ -54,18 +54,18 @@ public class TestMediaSession extends JingleMediaSession {
|
|||
* Starts transmission and for NAT Traversal reasons start receiving also.
|
||||
*/
|
||||
@Override
|
||||
public void startTrasmit() {
|
||||
public void startTransmit() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set transmit activity. If the active is true, the instance should trasmit.
|
||||
* Set transmit activity. If the active is true, the instance should transmit.
|
||||
* If it is set to false, the instance should pause transmit.
|
||||
*
|
||||
* @param active active state
|
||||
*/
|
||||
@Override
|
||||
public void setTrasmit(boolean active) {
|
||||
public void setTransmit(boolean active) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ public class TestMediaSession extends JingleMediaSession {
|
|||
* Stops transmission and for NAT Traversal reasons stop receiving also.
|
||||
*/
|
||||
@Override
|
||||
public void stopTrasmit() {
|
||||
public void stopTransmit() {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -44,11 +44,11 @@ import org.jivesoftware.smackx.jingleold.JingleSession;
|
|||
public class BridgedResolver extends TransportResolver {
|
||||
private static final Logger LOGGER = Logger.getLogger(BridgedResolver.class.getName());
|
||||
|
||||
XMPPConnection connection;
|
||||
private final XMPPConnection connection;
|
||||
|
||||
Random random = new Random();
|
||||
private final Random random = new Random();
|
||||
|
||||
long sid;
|
||||
private long sid;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -59,10 +59,10 @@ public class BridgedResolver extends TransportResolver {
|
|||
this.connection = connection;
|
||||
}
|
||||
|
||||
/**
|
||||
/**1
|
||||
* Resolve Bridged Candidate.
|
||||
* <p/>
|
||||
* The BridgedResolver takes the IP addresse and ports of a jmf proxy service.
|
||||
* The BridgedResolver takes the IP address and ports of a jmf proxy service.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
|
|
|
@ -32,6 +32,6 @@ public interface DatagramListener {
|
|||
* @param datagramPacket the datagram stanza(/packet) received.
|
||||
* @return ?
|
||||
*/
|
||||
public boolean datagramReceived(DatagramPacket datagramPacket);
|
||||
boolean datagramReceived(DatagramPacket datagramPacket);
|
||||
|
||||
}
|
||||
|
|
|
@ -233,7 +233,7 @@ public class ICECandidate extends TransportCandidate implements Comparable<ICECa
|
|||
final TestResult result = new TestResult();
|
||||
|
||||
// Media Proxy don't have Echo features.
|
||||
// If its a relayed candidate we assumpt that is NOT Valid while other candidates still being checked.
|
||||
// If its a relayed candidate we assumed that is NOT Valid while other candidates still being checked.
|
||||
// The negotiator MUST add then in the correct situations
|
||||
if (getType().equals(Type.relay)) {
|
||||
triggerCandidateChecked(false);
|
||||
|
|
|
@ -53,7 +53,7 @@ public class ICEResolver extends TransportResolver {
|
|||
long sid;
|
||||
String server;
|
||||
int port;
|
||||
static Map<String, ICENegociator> negociatorsMap = new HashMap<String, ICENegociator>();
|
||||
static Map<String, ICENegociator> negociatorsMap = new HashMap<>();
|
||||
// ICENegociator iceNegociator = null;
|
||||
|
||||
public ICEResolver(XMPPConnection connection, String server, int port) {
|
||||
|
@ -80,7 +80,7 @@ public class ICEResolver extends TransportResolver {
|
|||
|
||||
// gather candidates
|
||||
iceNegociator.gatherCandidateAddresses();
|
||||
// priorize candidates
|
||||
// prioritize candidates
|
||||
iceNegociator.prioritizeCandidates();
|
||||
// CHECKSTYLE:ON
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ public class ICEResolver extends TransportResolver {
|
|||
for (Candidate candidate : iceNegociator.getSortedCandidates())
|
||||
try {
|
||||
Candidate.CandidateType type = candidate.getCandidateType();
|
||||
ICECandidate.Type iceType = ICECandidate.Type.local;
|
||||
ICECandidate.Type iceType;
|
||||
if (type.equals(Candidate.CandidateType.ServerReflexive))
|
||||
iceType = ICECandidate.Type.srflx;
|
||||
else if (type.equals(Candidate.CandidateType.PeerReflexive))
|
||||
|
|
|
@ -42,7 +42,7 @@ public abstract class JingleTransportManager {
|
|||
// This class implements the context of a Strategy pattern...
|
||||
|
||||
/**
|
||||
* Deafult contructor.
|
||||
* Default constructor.
|
||||
*/
|
||||
public JingleTransportManager() {
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ public class RTPBridge extends IQ {
|
|||
/**
|
||||
* Get Side A receive port.
|
||||
*
|
||||
* @return the side A receive prot
|
||||
* @return the side A receive port
|
||||
*/
|
||||
public int getPortA() {
|
||||
return portA;
|
||||
|
|
|
@ -24,6 +24,6 @@ package org.jivesoftware.smackx.jingleold.nat;
|
|||
*/
|
||||
public interface ResultListener {
|
||||
|
||||
public void testFinished(TestResult result, TransportCandidate candidate);
|
||||
void testFinished(TestResult result, TransportCandidate candidate);
|
||||
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public class STUN extends SimpleIQ {
|
|||
|
||||
private static final Logger LOGGER = Logger.getLogger(STUN.class.getName());
|
||||
|
||||
private List<StunServerAddress> servers = new ArrayList<StunServerAddress>();
|
||||
private final List<StunServerAddress> servers = new ArrayList<>();
|
||||
|
||||
private String publicIp = null;
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ public class STUNResolver extends TransportResolver {
|
|||
* @return A list of loaded servers
|
||||
*/
|
||||
public ArrayList<STUNService> loadSTUNServers(java.io.InputStream stunConfigStream) {
|
||||
ArrayList<STUNService> serversList = new ArrayList<STUNService>();
|
||||
ArrayList<STUNService> serversList = new ArrayList<>();
|
||||
String serverName;
|
||||
int serverPort;
|
||||
|
||||
|
@ -218,7 +218,7 @@ public class STUNResolver extends TransportResolver {
|
|||
* @return a list of services
|
||||
*/
|
||||
public ArrayList<STUNService> loadSTUNServers() {
|
||||
ArrayList<STUNService> serversList = new ArrayList<STUNService>();
|
||||
ArrayList<STUNService> serversList = new ArrayList<>();
|
||||
|
||||
// Load the STUN configuration
|
||||
try {
|
||||
|
@ -234,7 +234,7 @@ public class STUNResolver extends TransportResolver {
|
|||
|
||||
while (stunConfigEnum.hasMoreElements() && serversList.isEmpty()) {
|
||||
URL url = stunConfigEnum.nextElement();
|
||||
java.io.InputStream stunConfigStream = null;
|
||||
java.io.InputStream stunConfigStream;
|
||||
|
||||
stunConfigStream = url.openStream();
|
||||
serversList.addAll(loadSTUNServers(stunConfigStream));
|
||||
|
|
|
@ -31,9 +31,7 @@ import java.util.logging.Level;
|
|||
import java.util.logging.Logger;
|
||||
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
|
||||
import org.jivesoftware.smackx.jingleold.JingleSession;
|
||||
import org.jivesoftware.smackx.jingleold.nat.TransportResolverListener.Checker;
|
||||
|
||||
import org.jxmpp.jid.Jid;
|
||||
|
||||
|
@ -74,7 +72,7 @@ public abstract class TransportCandidate {
|
|||
private Thread echoThread = null;
|
||||
|
||||
// Listeners for events
|
||||
private final List<TransportResolverListener.Checker> listeners = new ArrayList<Checker>();
|
||||
private final List<TransportResolverListener.Checker> listeners = new ArrayList<>();
|
||||
|
||||
public void addCandidateEcho(JingleSession session) throws SocketException, UnknownHostException {
|
||||
candidateEcho = new CandidateEcho(this, session);
|
||||
|
@ -134,12 +132,12 @@ public abstract class TransportCandidate {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the symetric candidate for this candidate.
|
||||
* Set the symmetric candidate for this candidate.
|
||||
*
|
||||
* @param symetric
|
||||
* @param symmetric
|
||||
*/
|
||||
public void setSymmetric(TransportCandidate symetric) {
|
||||
this.symmetric = symetric;
|
||||
public void setSymmetric(TransportCandidate symmetric) {
|
||||
this.symmetric = symmetric;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -400,7 +398,7 @@ public abstract class TransportCandidate {
|
|||
*/
|
||||
public List<TransportResolverListener.Checker> getListenersList() {
|
||||
synchronized (listeners) {
|
||||
return new ArrayList<Checker>(listeners);
|
||||
return new ArrayList<>(listeners);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -633,8 +631,8 @@ public abstract class TransportCandidate {
|
|||
byte[] send = null;
|
||||
byte[] receive = null;
|
||||
DatagramPacket sendStanza = null;
|
||||
List<DatagramListener> listeners = new ArrayList<DatagramListener>();
|
||||
List<ResultListener> resultListeners = new ArrayList<ResultListener>();
|
||||
List<DatagramListener> listeners = new ArrayList<>();
|
||||
List<ResultListener> resultListeners = new ArrayList<>();
|
||||
boolean enabled = true;
|
||||
boolean ended = false;
|
||||
long replyTries = 2;
|
||||
|
|
|
@ -60,23 +60,23 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
// transport (in milliseconds)
|
||||
public final static int CANDIDATES_ACCEPT_PERIOD = 4000;
|
||||
|
||||
// The session this nenotiator belongs to
|
||||
// The session this negotiator belongs to
|
||||
// private final JingleSession session;
|
||||
|
||||
// The transport manager
|
||||
private final TransportResolver resolver;
|
||||
|
||||
// Transport candidates we have offered
|
||||
private final List<TransportCandidate> offeredCandidates = new ArrayList<TransportCandidate>();
|
||||
private final List<TransportCandidate> offeredCandidates = new ArrayList<>();
|
||||
|
||||
// List of remote transport candidates
|
||||
private final List<TransportCandidate> remoteCandidates = new ArrayList<TransportCandidate>();
|
||||
private final List<TransportCandidate> remoteCandidates = new ArrayList<>();
|
||||
|
||||
// Valid remote candidates
|
||||
private final List<TransportCandidate> validRemoteCandidates = new ArrayList<TransportCandidate>();
|
||||
private final List<TransportCandidate> validRemoteCandidates = new ArrayList<>();
|
||||
|
||||
// Accepted Remote Candidates
|
||||
private final List<TransportCandidate> acceptedRemoteCandidates = new ArrayList<TransportCandidate>();
|
||||
private final List<TransportCandidate> acceptedRemoteCandidates = new ArrayList<>();
|
||||
|
||||
// The best local candidate we have offered (and accepted by the other part)
|
||||
private TransportCandidate acceptedLocalCandidate;
|
||||
|
@ -87,7 +87,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
// Listener for the resolver
|
||||
private TransportResolverListener.Resolver resolverListener;
|
||||
|
||||
private ContentNegotiator parentNegotiator;
|
||||
private final ContentNegotiator parentNegotiator;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
|
@ -359,7 +359,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
if (candidate instanceof ICECandidate) {
|
||||
ICECandidate iceCandidate = (ICECandidate) candidate;
|
||||
if (iceCandidate.getType().equals(Type.relay)) {
|
||||
// TODO Check if the relay is reacheable.
|
||||
// TODO Check if the relay is reachable.
|
||||
addValidRemoteCandidate(iceCandidate);
|
||||
foundRemoteRelay = true;
|
||||
}
|
||||
|
@ -473,7 +473,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
*/
|
||||
final ArrayList<TransportCandidate> getValidRemoteCandidatesList() {
|
||||
synchronized (validRemoteCandidates) {
|
||||
return new ArrayList<TransportCandidate>(validRemoteCandidates);
|
||||
return new ArrayList<>(validRemoteCandidates);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -509,7 +509,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
* @param jin The input jingle packet
|
||||
*/
|
||||
private List<TransportCandidate> obtainCandidatesList(Jingle jingle) {
|
||||
List<TransportCandidate> result = new ArrayList<TransportCandidate>();
|
||||
List<TransportCandidate> result = new ArrayList<>();
|
||||
|
||||
if (jingle != null) {
|
||||
// Get the list of candidates from the packet
|
||||
|
@ -598,7 +598,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
|
||||
/**
|
||||
* Dispatch an incoming packet. The method is responsible for recognizing
|
||||
* the stanza(/packet) type and, depending on the current state, deliverying the
|
||||
* the stanza(/packet) type and, depending on the current state, delivering the
|
||||
* stanza(/packet) to the right event handler and wait for a response.
|
||||
*
|
||||
* @param iq the stanza(/packet) received
|
||||
|
@ -609,7 +609,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
*/
|
||||
@Override
|
||||
public final List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException, InterruptedException {
|
||||
List<IQ> responses = new ArrayList<IQ>();
|
||||
List<IQ> responses = new ArrayList<>();
|
||||
IQ response = null;
|
||||
|
||||
if (iq != null) {
|
||||
|
@ -690,7 +690,6 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
|
||||
/**
|
||||
* @param jingle
|
||||
* @param jingleTransport
|
||||
* @return the iq
|
||||
* @throws SmackException
|
||||
* @throws InterruptedException
|
||||
|
@ -704,7 +703,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
// Start offering candidates
|
||||
sendTransportCandidatesOffer();
|
||||
|
||||
// All these candidates will be checked asyncronously. Wait for some
|
||||
// All these candidates will be checked asynchronously. Wait for some
|
||||
// time and check if we have a valid candidate to use...
|
||||
delayedCheckBestCandidate(session, jingle);
|
||||
|
||||
|
@ -716,7 +715,6 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
|
||||
/**
|
||||
* @param jingle
|
||||
* @param jingleTransport
|
||||
* @return the iq
|
||||
*/
|
||||
private IQ receiveTransportInfoAction(Jingle jingle) {
|
||||
|
@ -728,7 +726,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
// // Start offering candidates
|
||||
// sendTransportCandidatesOffer();
|
||||
//
|
||||
// // All these candidates will be checked asyncronously. Wait for some
|
||||
// // All these candidates will be checked asynchronously. Wait for some
|
||||
// // time and check if we have a valid candidate to use...
|
||||
// delayedCheckBestCandidate(session, jingle);
|
||||
//
|
||||
|
@ -750,7 +748,6 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
/**
|
||||
* One of our transport candidates has been accepted.
|
||||
*
|
||||
* @param jin The input packet
|
||||
* @return a Jingle packet
|
||||
* @throws XMPPException an exception
|
||||
* @see org.jivesoftware.smackx.jingleold.JingleNegotiator.State#eventAccept(org.jivesoftware.smackx.jingleold.packet.Jingle)
|
||||
|
@ -763,7 +760,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
if (!accepted.isEmpty()) {
|
||||
|
||||
for (TransportCandidate cand : accepted) {
|
||||
LOGGER.fine("Remote acccepted candidate addr: " + cand.getIp());
|
||||
LOGGER.fine("Remote accepted candidate addr: " + cand.getIp());
|
||||
}
|
||||
|
||||
TransportCandidate cand = accepted.get(0);
|
||||
|
@ -784,7 +781,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
private static IQ receiveSessionAcceptAction(Jingle jingle) {
|
||||
IQ response = null;
|
||||
|
||||
LOGGER.fine("Transport stabilished");
|
||||
LOGGER.fine("Transport established");
|
||||
// triggerTransportEstablished(getAcceptedLocalCandidate(), getBestRemoteCandidate());
|
||||
|
||||
// setNegotiatorState(JingleNegotiatorState.SUCCEEDED);
|
||||
|
|
|
@ -62,7 +62,7 @@ public abstract class TransportResolver {
|
|||
public static final int CHECK_TIMEOUT = 3000;
|
||||
|
||||
// Listeners for events
|
||||
private final ArrayList<TransportResolverListener> listeners = new ArrayList<TransportResolverListener>();
|
||||
private final ArrayList<TransportResolverListener> listeners = new ArrayList<>();
|
||||
|
||||
// TRue if the resolver is working
|
||||
private boolean resolving;
|
||||
|
@ -76,7 +76,7 @@ public abstract class TransportResolver {
|
|||
// We store a list of candidates internally, just in case there are several
|
||||
// possibilities. When the user asks for a transport, we return the best
|
||||
// one.
|
||||
protected final List<TransportCandidate> candidates = new ArrayList<TransportCandidate>();
|
||||
protected final List<TransportCandidate> candidates = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
|
@ -142,7 +142,7 @@ public abstract class TransportResolver {
|
|||
}
|
||||
|
||||
/**
|
||||
* Chack if the Transport Resolver is initialized.
|
||||
* Check if the Transport Resolver is initialized.
|
||||
*
|
||||
* @return true if initialized
|
||||
*/
|
||||
|
@ -151,8 +151,8 @@ public abstract class TransportResolver {
|
|||
}
|
||||
|
||||
/**
|
||||
* Indicate the beggining of the resolution process. This method must be
|
||||
* used by subclasses at the begining of their resolve() method.
|
||||
* Indicate the beginning of the resolution process. This method must be
|
||||
* used by subclasses at the beginning of their resolve() method.
|
||||
*/
|
||||
protected synchronized void setResolveInit() {
|
||||
resolved = false;
|
||||
|
@ -163,7 +163,7 @@ public abstract class TransportResolver {
|
|||
|
||||
/**
|
||||
* Indicate the end of the resolution process. This method must be used by
|
||||
* subclasses at the begining of their resolve() method.
|
||||
* subclasses at the beginning of their resolve() method.
|
||||
*/
|
||||
protected synchronized void setResolveEnd() {
|
||||
resolved = true;
|
||||
|
@ -203,7 +203,7 @@ public abstract class TransportResolver {
|
|||
*/
|
||||
public ArrayList<TransportResolverListener> getListenersList() {
|
||||
synchronized (listeners) {
|
||||
return new ArrayList<TransportResolverListener>(listeners);
|
||||
return new ArrayList<>(listeners);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -241,7 +241,7 @@ public abstract class TransportResolver {
|
|||
}
|
||||
|
||||
/**
|
||||
* Trigger a event notifying the obtention of all the candidates.
|
||||
* Trigger a event notifying the obtainment of all the candidates.
|
||||
*/
|
||||
private void triggerResolveEnd() {
|
||||
Iterator<TransportResolverListener> iter = getListenersList().iterator();
|
||||
|
@ -289,19 +289,19 @@ public abstract class TransportResolver {
|
|||
*/
|
||||
public Iterator<TransportCandidate> getCandidates() {
|
||||
synchronized (candidates) {
|
||||
return Collections.unmodifiableList(new ArrayList<TransportCandidate>(candidates)).iterator();
|
||||
return Collections.unmodifiableList(new ArrayList<>(candidates)).iterator();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the candididate with the highest preference.
|
||||
* Get the candidate with the highest preference.
|
||||
*
|
||||
* @return The best candidate, according to the preference order.
|
||||
*/
|
||||
public TransportCandidate getPreferredCandidate() {
|
||||
TransportCandidate result = null;
|
||||
|
||||
ArrayList<ICECandidate> cands = new ArrayList<ICECandidate>();
|
||||
ArrayList<ICECandidate> cands = new ArrayList<>();
|
||||
for (TransportCandidate tpcan : getCandidatesList()) {
|
||||
if (tpcan instanceof ICECandidate)
|
||||
cands.add((ICECandidate) tpcan);
|
||||
|
@ -319,7 +319,7 @@ public abstract class TransportResolver {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the numer of transport candidates.
|
||||
* Get the number of transport candidates.
|
||||
*
|
||||
* @return The length of the transport candidates list.
|
||||
*/
|
||||
|
@ -335,10 +335,10 @@ public abstract class TransportResolver {
|
|||
* @return the list of transport candidates
|
||||
*/
|
||||
public List<TransportCandidate> getCandidatesList() {
|
||||
List<TransportCandidate> result = null;
|
||||
List<TransportCandidate> result;
|
||||
|
||||
synchronized (candidates) {
|
||||
result = new ArrayList<TransportCandidate>(candidates);
|
||||
result = new ArrayList<>(candidates);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -359,7 +359,7 @@ public abstract class TransportResolver {
|
|||
}
|
||||
|
||||
/**
|
||||
* Initialize Transport Resolver and wait until it is complete unitialized.
|
||||
* Initialize Transport Resolver and wait until it is completely uninitialized.
|
||||
* @throws SmackException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
|
|
|
@ -21,15 +21,15 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
|
|||
/**
|
||||
* Transport resolver Interface .
|
||||
*/
|
||||
public abstract interface TransportResolverListener {
|
||||
public interface TransportResolverListener {
|
||||
/**
|
||||
* Resolver listener.
|
||||
*/
|
||||
public interface Resolver extends TransportResolverListener {
|
||||
interface Resolver extends TransportResolverListener {
|
||||
/**
|
||||
* The resolution process has been started.
|
||||
*/
|
||||
public void init();
|
||||
void init();
|
||||
|
||||
/**
|
||||
* A transport candidate has been added.
|
||||
|
@ -38,31 +38,31 @@ public abstract interface TransportResolverListener {
|
|||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void candidateAdded(TransportCandidate cand) throws NotConnectedException, InterruptedException;
|
||||
void candidateAdded(TransportCandidate cand) throws NotConnectedException, InterruptedException;
|
||||
|
||||
/**
|
||||
* All the transport candidates have been obtained.
|
||||
*/
|
||||
public void end();
|
||||
void end();
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolver checker.
|
||||
*/
|
||||
public interface Checker extends TransportResolverListener {
|
||||
interface Checker extends TransportResolverListener {
|
||||
/**
|
||||
* A transport candidate has been checked.
|
||||
*
|
||||
* @param cand The transport candidate that has been checked.
|
||||
* @param result True if the candidate is usable.
|
||||
*/
|
||||
public void candidateChecked(TransportCandidate cand, boolean result);
|
||||
void candidateChecked(TransportCandidate cand, boolean result);
|
||||
|
||||
/**
|
||||
* A transport candidate is being checked.
|
||||
*
|
||||
* @param cand The transport candidate that is being checked.
|
||||
*/
|
||||
public void candidateChecking(TransportCandidate cand);
|
||||
void candidateChecking(TransportCandidate cand);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public class Jingle extends IQ {
|
|||
|
||||
// Sub-elements of a Jingle object.
|
||||
|
||||
private final List<JingleContent> contents = new ArrayList<JingleContent>();
|
||||
private final List<JingleContent> contents = new ArrayList<>();
|
||||
|
||||
private JingleContentInfo contentInfo;
|
||||
|
||||
|
@ -222,7 +222,7 @@ public class Jingle extends IQ {
|
|||
*/
|
||||
public Iterator<JingleContent> getContents() {
|
||||
synchronized (contents) {
|
||||
return Collections.unmodifiableList(new ArrayList<JingleContent>(contents)).iterator();
|
||||
return Collections.unmodifiableList(new ArrayList<>(contents)).iterator();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,7 @@ public class Jingle extends IQ {
|
|||
*/
|
||||
public List<JingleContent> getContentsList() {
|
||||
synchronized (contents) {
|
||||
return new ArrayList<JingleContent>(contents);
|
||||
return new ArrayList<>(contents);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -305,7 +305,7 @@ public class Jingle extends IQ {
|
|||
|
||||
/**
|
||||
* Get the responder. The responder is the full JID of the entity that has
|
||||
* replied to the initiation (which may be different to the "to" addresss in
|
||||
* replied to the initiation (which may be different to the "to" address in
|
||||
* the IQ).
|
||||
*
|
||||
* @return the responder
|
||||
|
@ -317,7 +317,7 @@ public class Jingle extends IQ {
|
|||
/**
|
||||
* Set the responder. The responder must be the full JID of the entity that
|
||||
* has replied to the initiation (which may be different to the "to"
|
||||
* addresss in the IQ).
|
||||
* address in the IQ).
|
||||
*
|
||||
* @param resp the responder to set
|
||||
*/
|
||||
|
|
|
@ -38,7 +38,7 @@ public class JingleContent implements ExtensionElement {
|
|||
private String name;
|
||||
|
||||
private JingleDescription description;
|
||||
private final List<JingleTransport> transports = new ArrayList<JingleTransport>();
|
||||
private final List<JingleTransport> transports = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Creates a content description..
|
||||
|
@ -101,7 +101,7 @@ public class JingleContent implements ExtensionElement {
|
|||
* Adds a JingleTransport type to the packet.
|
||||
*
|
||||
* @param transport
|
||||
* the JignleTransport to add.
|
||||
* the JingleTransport to add.
|
||||
*/
|
||||
public void addJingleTransport(final JingleTransport transport) {
|
||||
synchronized (transports) {
|
||||
|
@ -139,7 +139,7 @@ public class JingleContent implements ExtensionElement {
|
|||
*/
|
||||
public List<JingleTransport> getJingleTransportsList() {
|
||||
synchronized (transports) {
|
||||
return new ArrayList<JingleTransport>(transports);
|
||||
return new ArrayList<>(transports);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ public abstract class JingleContentDescription implements ExtensionElement {
|
|||
|
||||
// non-static
|
||||
|
||||
private final List<JinglePayloadType> payloads = new ArrayList<JinglePayloadType>();
|
||||
private final List<JinglePayloadType> payloads = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Creates a content description..
|
||||
|
@ -107,7 +107,7 @@ public abstract class JingleContentDescription implements ExtensionElement {
|
|||
*/
|
||||
public ArrayList<JinglePayloadType> getJinglePayloadTypesList() {
|
||||
synchronized (payloads) {
|
||||
return new ArrayList<JinglePayloadType>(payloads);
|
||||
return new ArrayList<>(payloads);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ public abstract class JingleContentDescription implements ExtensionElement {
|
|||
* @return a list of PayloadType.Audio
|
||||
*/
|
||||
public ArrayList<PayloadType.Audio> getAudioPayloadTypesList() {
|
||||
ArrayList<PayloadType.Audio> result = new ArrayList<PayloadType.Audio>();
|
||||
ArrayList<PayloadType.Audio> result = new ArrayList<>();
|
||||
Iterator<JinglePayloadType> jinglePtsIter = getJinglePayloadTypes();
|
||||
|
||||
while (jinglePtsIter.hasNext()) {
|
||||
|
|
|
@ -76,7 +76,7 @@ public class JingleContentInfo implements ExtensionElement {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the publilc namespace.
|
||||
* Get the public namespace.
|
||||
*/
|
||||
@Override
|
||||
public String getNamespace() {
|
||||
|
|
|
@ -41,7 +41,7 @@ public abstract class JingleDescription implements ExtensionElement {
|
|||
|
||||
// non-static
|
||||
|
||||
private final List<PayloadType> payloads = new ArrayList<PayloadType>();
|
||||
private final List<PayloadType> payloads = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Creates a content description..
|
||||
|
@ -114,7 +114,7 @@ public abstract class JingleDescription implements ExtensionElement {
|
|||
*/
|
||||
public List<PayloadType> getPayloadTypesList() {
|
||||
synchronized (payloads) {
|
||||
return new ArrayList<PayloadType>(payloads);
|
||||
return new ArrayList<>(payloads);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ public abstract class JingleDescription implements ExtensionElement {
|
|||
* @return a list of PayloadType.Audio
|
||||
*/
|
||||
public List<PayloadType> getAudioPayloadTypesList() {
|
||||
ArrayList<PayloadType> result = new ArrayList<PayloadType>();
|
||||
ArrayList<PayloadType> result = new ArrayList<>();
|
||||
Iterator<PayloadType> jinglePtsIter = getPayloadTypes();
|
||||
|
||||
while (jinglePtsIter.hasNext()) {
|
||||
|
|
|
@ -103,9 +103,9 @@ public class JingleTransport implements ExtensionElement {
|
|||
* @return The candidates list.
|
||||
*/
|
||||
public List<JingleTransportCandidate> getCandidatesList() {
|
||||
ArrayList<JingleTransportCandidate> res = null;
|
||||
ArrayList<JingleTransportCandidate> res;
|
||||
synchronized (candidates) {
|
||||
res = new ArrayList<JingleTransportCandidate>(candidates);
|
||||
res = new ArrayList<>(candidates);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ public class JingleTransport implements ExtensionElement {
|
|||
}
|
||||
|
||||
/**
|
||||
* Obtain a valid XML representation of a trancport candidate.
|
||||
* Obtain a valid XML representation of a transport candidate.
|
||||
*
|
||||
* @return A string containing the XML dump of the transport candidate.
|
||||
*/
|
||||
|
@ -295,7 +295,7 @@ public class JingleTransport implements ExtensionElement {
|
|||
*/
|
||||
@Override
|
||||
public List<JingleTransportCandidate> getCandidatesList() {
|
||||
List<JingleTransportCandidate> copy = new ArrayList<JingleTransportCandidate>();
|
||||
List<JingleTransportCandidate> copy = new ArrayList<>();
|
||||
List<JingleTransportCandidate> superCandidatesList = super.getCandidatesList();
|
||||
for (int i = 0; i < superCandidatesList.size(); i++) {
|
||||
copy.add(superCandidatesList.get(i));
|
||||
|
@ -381,7 +381,7 @@ public class JingleTransport implements ExtensionElement {
|
|||
*/
|
||||
@Override
|
||||
public List<JingleTransportCandidate> getCandidatesList() {
|
||||
List<JingleTransportCandidate> copy = new ArrayList<JingleTransportCandidate>();
|
||||
List<JingleTransportCandidate> copy = new ArrayList<>();
|
||||
List<JingleTransportCandidate> superCandidatesList = super.getCandidatesList();
|
||||
if (superCandidatesList.size() > 0) {
|
||||
copy.add(superCandidatesList.get(0));
|
||||
|
|
|
@ -50,8 +50,7 @@ public class JingleProvider extends IQProvider<Jingle> {
|
|||
Jingle jingle = new Jingle();
|
||||
String sid = "";
|
||||
JingleActionEnum action;
|
||||
Jid initiator = null;
|
||||
Jid responder = null;
|
||||
Jid initiator, responder;
|
||||
boolean done = false;
|
||||
JingleContent currentContent = null;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue