mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 17:19:39 +02:00
's;^\s+$;;' on all source files
And add checkstyle test for lines containing only whitespace characters.
This commit is contained in:
parent
05c97c494b
commit
0fde39fa45
193 changed files with 1066 additions and 1062 deletions
|
@ -59,7 +59,7 @@ public class Demo extends JFrame {
|
|||
this.server = server;
|
||||
this.user = user;
|
||||
this.pass = pass;
|
||||
|
||||
|
||||
if (user.equals("jeffw")) {
|
||||
jid = new JTextField("eowyn" + "@" + server + "/Smack");
|
||||
} else {
|
||||
|
|
|
@ -264,7 +264,7 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
|
||||
JingleManager man0 = new JingleManager(getConnection(0), trl0);
|
||||
JingleManager man1 = new JingleManager(getConnection(1), trl1);
|
||||
|
||||
|
||||
man1.addJingleSessionRequestListener(new JingleSessionRequestListener() {
|
||||
/**
|
||||
* Called when a new session request is detected
|
||||
|
@ -323,10 +323,10 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
|
||||
JingleManager man0 = new JingleManager(getConnection(0), trl0);
|
||||
JingleManager man1 = new JingleManager(getConnection(1), trl1);
|
||||
|
||||
|
||||
man0.addCreationListener(ftm0);
|
||||
man1.addCreationListener(ftm1);
|
||||
|
||||
|
||||
man1.addJingleSessionRequestListener(new JingleSessionRequestListener() {
|
||||
/**
|
||||
* Called when a new session request is detected
|
||||
|
@ -527,7 +527,7 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
|
||||
JingleManager man0 = new JingleManager(getConnection(0), trl0);
|
||||
JingleManager man1 = new JingleManager(getConnection(1), trl1);
|
||||
|
||||
|
||||
man1.addJingleSessionRequestListener(new JingleSessionRequestListener() {
|
||||
/**
|
||||
* Called when a new session request is detected
|
||||
|
@ -681,7 +681,7 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
public void testFullTest() {
|
||||
|
||||
resetCounter();
|
||||
|
||||
|
||||
XMPPTCPConnection x0 = getConnection(0);
|
||||
XMPPTCPConnection x1 = getConnection(1);
|
||||
|
||||
|
@ -701,7 +701,7 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
|
||||
JingleManager man0 = new JingleManager(x0, trl0);
|
||||
JingleManager man1 = new JingleManager(x1, trl1);
|
||||
|
||||
|
||||
man1.addJingleSessionRequestListener(new JingleSessionRequestListener() {
|
||||
public void sessionRequested(final JingleSessionRequest request) {
|
||||
|
||||
|
@ -796,7 +796,7 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
public void testMediaManager() {
|
||||
|
||||
resetCounter();
|
||||
|
||||
|
||||
XMPPTCPConnection x0 = getConnection(0);
|
||||
XMPPTCPConnection x1 = getConnection(1);
|
||||
|
||||
|
@ -807,7 +807,7 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
FixedTransportManager ftm1 = new FixedTransportManager(tr1);
|
||||
|
||||
try {
|
||||
|
||||
|
||||
JingleMediaManager jingleMediaManager = new JingleMediaManager(ftm0) {
|
||||
// Media Session Implementation
|
||||
public JingleMediaSession createMediaSession(final PayloadType payloadType, final TransportCandidate remote,
|
||||
|
@ -852,7 +852,7 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
List<JingleMediaManager> trl0 = new ArrayList<JingleMediaManager>();
|
||||
trl0.add(jingleMediaManager);
|
||||
|
||||
|
@ -901,11 +901,11 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
/**
|
||||
* This is a simple test where the user_2 rejects the Jingle session.
|
||||
*/
|
||||
|
||||
|
||||
// This test doesn't make sense in light of multiple <content> sections allowed in XEp-166.
|
||||
// What we really need is a test for actions: content-add and content-remove.
|
||||
|
||||
|
||||
|
||||
|
||||
// public void testIncompatibleCodecs() {
|
||||
//
|
||||
// resetCounter();
|
||||
|
|
|
@ -283,7 +283,7 @@ public class JingleMediaTest extends SmackTestCase {
|
|||
|
||||
final JingleManager jm0 = new JingleManager(x0, jml0);
|
||||
final JingleManager jm1 = new JingleManager(x1, jml1);
|
||||
|
||||
|
||||
jm1.addJingleSessionRequestListener(new JingleSessionRequestListener() {
|
||||
public void sessionRequested(final JingleSessionRequest request) {
|
||||
|
||||
|
@ -327,7 +327,7 @@ public class JingleMediaTest extends SmackTestCase {
|
|||
|
||||
XMPPTCPConnection x0 = getConnection(n);
|
||||
XMPPTCPConnection x1 = getConnection(n + 1);
|
||||
|
||||
|
||||
BridgedTransportManager btm0 = new BridgedTransportManager(x0);
|
||||
BridgedTransportManager btm1 = new BridgedTransportManager(x1);
|
||||
|
||||
|
@ -346,7 +346,7 @@ public class JingleMediaTest extends SmackTestCase {
|
|||
|
||||
jm0.addCreationListener(btm0);
|
||||
jm1.addCreationListener(btm1);
|
||||
|
||||
|
||||
jm1.addJingleSessionRequestListener(new JingleSessionRequestListener() {
|
||||
public void sessionRequested(final JingleSessionRequest request) {
|
||||
|
||||
|
@ -369,7 +369,7 @@ public class JingleMediaTest extends SmackTestCase {
|
|||
|
||||
//js0.sendFormattedError(JingleError.UNSUPPORTED_TRANSPORTS);
|
||||
js0.sendStanza(js0.createJingleError(null, JingleError.UNSUPPORTED_TRANSPORTS));
|
||||
|
||||
|
||||
|
||||
Thread.sleep(20000);
|
||||
|
||||
|
|
|
@ -30,13 +30,13 @@ public class JingleSessionTest extends SmackTestCase {
|
|||
}
|
||||
|
||||
public void testEqualsObject() {
|
||||
|
||||
|
||||
FixedResolver tr1 = new FixedResolver("127.0.0.1", 54222);
|
||||
FixedTransportManager ftm1 = new FixedTransportManager(tr1);
|
||||
TestMediaManager tmm1 = new TestMediaManager(ftm1);
|
||||
List<JingleMediaManager> trl1 = new ArrayList<JingleMediaManager>();
|
||||
trl1.add(tmm1);
|
||||
|
||||
|
||||
JingleSession js1 = new JingleSession(getConnection(0), "res1", null, "10", trl1);
|
||||
JingleSession js2 = new JingleSession(getConnection(1), "res1", null, "10", trl1);
|
||||
JingleSession js3 = new JingleSession(getConnection(2), "res2", null, "11", trl1);
|
||||
|
@ -66,7 +66,7 @@ public class JingleSessionTest extends SmackTestCase {
|
|||
TestMediaManager tmm1 = new TestMediaManager(ftm1);
|
||||
List<JingleMediaManager> trl1 = new ArrayList<JingleMediaManager>();
|
||||
trl1.add(tmm1);
|
||||
|
||||
|
||||
JingleSession js1 = new JingleSession(getConnection(0), ini1, null, sid1, trl1);
|
||||
JingleSession js2 = new JingleSession(getConnection(1), ini2, null, sid2, trl1);
|
||||
|
||||
|
|
|
@ -31,27 +31,27 @@ public class PayloadTypeTest extends SmackTestCase {
|
|||
PayloadType p2 = new PayloadType(0, "pt1", 2);
|
||||
assertTrue(p1.equals(p2));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test for the difference of payloads.
|
||||
*/
|
||||
public void testDifference() {
|
||||
ArrayList<Audio> set1 = new ArrayList<Audio>();
|
||||
ArrayList<Audio> set2 = new ArrayList<Audio>();
|
||||
|
||||
|
||||
PayloadType.Audio common1 = new PayloadType.Audio(34, "supercodec-1", 2, 14000);
|
||||
PayloadType.Audio common2 = new PayloadType.Audio(56, "supercodec-2", 1, 44000);
|
||||
|
||||
|
||||
set1.add(common1);
|
||||
set1.add(common2);
|
||||
set1.add(new PayloadType.Audio(36, "supercodec-3", 2, 28000));
|
||||
set1.add(new PayloadType.Audio(45, "supercodec-4", 1, 98000));
|
||||
|
||||
|
||||
set2.add(new PayloadType.Audio(27, "supercodec-3", 2, 28000));
|
||||
set2.add(common2);
|
||||
set2.add(new PayloadType.Audio(32, "supercodec-4", 1, 98000));
|
||||
set2.add(common1);
|
||||
|
||||
|
||||
// Get the difference
|
||||
ArrayList<Audio> commonSet = new ArrayList<Audio>();
|
||||
commonSet.addAll(set1);
|
||||
|
@ -60,7 +60,7 @@ public class PayloadTypeTest extends SmackTestCase {
|
|||
assertTrue(commonSet.size() == 2);
|
||||
System.out.println("Codec " + ((PayloadType.Audio)commonSet.get(0)).getId());
|
||||
System.out.println("Codec " + ((PayloadType.Audio)commonSet.get(1)).getId());
|
||||
|
||||
|
||||
assertTrue(commonSet.contains(common1));
|
||||
assertTrue(commonSet.contains(common2));
|
||||
}
|
||||
|
@ -71,22 +71,22 @@ public class PayloadTypeTest extends SmackTestCase {
|
|||
public void testDifferenceSameSet() {
|
||||
ArrayList<Audio> set1 = new ArrayList<Audio>();
|
||||
ArrayList<Audio> set2 = new ArrayList<Audio>();
|
||||
|
||||
|
||||
PayloadType.Audio common1 = new PayloadType.Audio(34, "supercodec-1", 2, 14000);
|
||||
PayloadType.Audio common2 = new PayloadType.Audio(56, "supercodec-2", 1, 44000);
|
||||
PayloadType.Audio common3 = new PayloadType.Audio(0, "supercodec-3", 1, 44000);
|
||||
PayloadType.Audio common4 = new PayloadType.Audio(120, "supercodec-4", 2, 66060);
|
||||
|
||||
|
||||
set1.add(common1);
|
||||
set1.add(common2);
|
||||
set1.add(common3);
|
||||
set1.add(common4);
|
||||
|
||||
|
||||
set2.add(common1);
|
||||
set2.add(common2);
|
||||
set2.add(common3);
|
||||
set2.add(common4);
|
||||
|
||||
|
||||
// Get the difference
|
||||
ArrayList<Audio> commonSet = new ArrayList<Audio>();
|
||||
commonSet.addAll(set1);
|
||||
|
|
|
@ -56,7 +56,7 @@ public class BasicResolverTest extends SmackTestCase {
|
|||
TransportCandidate tc = new TransportCandidate.Fixed(validHostname, 0);
|
||||
|
||||
resetCounter();
|
||||
|
||||
|
||||
tc.addListener(new TransportResolverListener.Checker() {
|
||||
public void candidateChecked(TransportCandidate cand, boolean result) {
|
||||
if(result == true) {
|
||||
|
@ -66,17 +66,17 @@ public class BasicResolverTest extends SmackTestCase {
|
|||
}
|
||||
|
||||
public void candidateChecking(TransportCandidate cand) {
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
tc.check(new ArrayList<TransportCandidate>());
|
||||
|
||||
|
||||
try {
|
||||
Thread.sleep(TransportResolver.CHECK_TIMEOUT);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
|
||||
assertTrue(valCounter() > 0);
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ public class BasicResolverTest extends SmackTestCase {
|
|||
TransportCandidate tc = new TransportCandidate.Fixed(invalidHostname, 0);
|
||||
|
||||
resetCounter();
|
||||
|
||||
|
||||
tc.addListener(new TransportResolverListener.Checker() {
|
||||
public void candidateChecked(TransportCandidate cand, boolean result) {
|
||||
if(result == false) {
|
||||
|
@ -98,9 +98,9 @@ public class BasicResolverTest extends SmackTestCase {
|
|||
public void candidateChecking(TransportCandidate cand) {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
tc.check(new ArrayList<TransportCandidate>());
|
||||
|
||||
|
||||
try {
|
||||
Thread.sleep(TransportResolver.CHECK_TIMEOUT);
|
||||
} catch (Exception e) {
|
||||
|
@ -109,7 +109,7 @@ public class BasicResolverTest extends SmackTestCase {
|
|||
assertTrue(valCounter() > 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected int getMaxConnections() {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ public class STUNResolverTest extends SmackTestCase {
|
|||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
TransportCandidate transportCandidate = new ICECandidate(candidate.getAddress().getInetAddress()
|
||||
.getHostAddress(), 1, nicNum, "1", candidate.getPort(), "1", candidate.getPriority(),
|
||||
|
|
|
@ -25,7 +25,7 @@ public class TransportResolverTest extends SmackTestCase {
|
|||
|
||||
public void testIsResolving() {
|
||||
final TransportResolver tr = new BasicResolver();
|
||||
|
||||
|
||||
tr.addListener(
|
||||
new TransportResolverListener.Resolver() {
|
||||
public void candidateAdded(final TransportCandidate cand) {
|
||||
|
@ -48,7 +48,7 @@ public class TransportResolverTest extends SmackTestCase {
|
|||
|
||||
assertFalse(tr.isResolving());
|
||||
assertFalse(tr.isResolved());
|
||||
|
||||
|
||||
try {
|
||||
tr.resolve(null);
|
||||
} catch (XMPPException e) {
|
||||
|
|
|
@ -36,13 +36,13 @@ public class JingleProviderTest extends SmackTestCase {
|
|||
String nameSpace = Jingle.getNamespace();
|
||||
|
||||
System.out.println("Testing if the Jingle IQ provider is registered...");
|
||||
|
||||
|
||||
// Verify that the Jingle IQProvider is registered.
|
||||
iqProv = (IQProvider)ProviderManager.getInstance().getIQProvider(elementNamee, nameSpace);
|
||||
|
||||
|
||||
assertNotNull(iqProv);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test for parsing a Jingle
|
||||
*/
|
||||
|
@ -93,7 +93,7 @@ public class JingleProviderTest extends SmackTestCase {
|
|||
assertTrue(iqReceived instanceof Jingle);
|
||||
|
||||
Jingle jin = (Jingle) iqReceived;
|
||||
|
||||
|
||||
System.out.println("Sent: " + iqSent.toXML());
|
||||
System.out.println("Received: " + jin.toXML());
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.jivesoftware.smackx.jingleold.packet.JingleError;
|
|||
*/
|
||||
public class JingleException extends XMPPException {
|
||||
private static final long serialVersionUID = -1521230401958103382L;
|
||||
|
||||
|
||||
private final JingleError error;
|
||||
|
||||
/**
|
||||
|
|
|
@ -185,7 +185,7 @@ import org.jxmpp.jid.Jid;
|
|||
public class JingleManager implements JingleSessionListener {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(JingleManager.class.getName());
|
||||
|
||||
|
||||
// non-static
|
||||
|
||||
final List<JingleSession> jingleSessions = new ArrayList<JingleSession>();
|
||||
|
@ -247,7 +247,7 @@ public class JingleManager implements JingleSessionListener {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Setup the jingle system to let the remote clients know we support Jingle.
|
||||
* (This used to be a static part of construction. The problem is a remote client might
|
||||
|
|
|
@ -53,9 +53,9 @@ public abstract class JingleNegotiator {
|
|||
private String expectedAckId;
|
||||
|
||||
private JingleNegotiatorState state;
|
||||
|
||||
|
||||
private boolean isStarted;
|
||||
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
|
@ -78,9 +78,9 @@ public abstract class JingleNegotiator {
|
|||
}
|
||||
|
||||
public void setNegotiatorState(JingleNegotiatorState stateIs) {
|
||||
|
||||
|
||||
JingleNegotiatorState stateWas = state;
|
||||
|
||||
|
||||
LOGGER.fine("Negotiator state change: " + stateWas + "->" + stateIs + "(" + this.getClass().getSimpleName() + ")");
|
||||
|
||||
switch (stateIs) {
|
||||
|
@ -236,21 +236,21 @@ public abstract class JingleNegotiator {
|
|||
*/
|
||||
public abstract List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException, InterruptedException;
|
||||
|
||||
|
||||
|
||||
public void start() {
|
||||
isStarted = true;
|
||||
doStart();
|
||||
}
|
||||
|
||||
|
||||
public boolean isStarted() {
|
||||
return isStarted;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Each of the negotiators has their individual behavior when they start.
|
||||
*/
|
||||
protected abstract void doStart();
|
||||
|
||||
|
||||
/**
|
||||
* Close the negotiation.
|
||||
*/
|
||||
|
|
|
@ -77,7 +77,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
private String sid; // A unique id that identifies this session
|
||||
|
||||
ConnectionListener connectionListener;
|
||||
|
||||
|
||||
StanzaListener packetListener;
|
||||
|
||||
StanzaFilter packetFilter;
|
||||
|
@ -91,7 +91,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
private XMPPConnection connection;
|
||||
|
||||
private String sessionInitPacketID;
|
||||
|
||||
|
||||
private Map<String, JingleMediaSession> mediaSessionMap;
|
||||
|
||||
/**
|
||||
|
@ -121,7 +121,7 @@ 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>();
|
||||
|
||||
|
@ -394,7 +394,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
contentNegotiators.add(inContentNegotiator);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------
|
||||
// Send section
|
||||
|
@ -642,11 +642,11 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
connection.addConnectionListener(connectionListener);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void removeConnectionListener() {
|
||||
if (connectionListener != null) {
|
||||
getConnection().removeConnectionListener(connectionListener);
|
||||
|
||||
|
||||
LOGGER.fine("JINGLE SESSION: REMOVE CONNECTION LISTENER");
|
||||
}
|
||||
}
|
||||
|
@ -823,17 +823,17 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
|
||||
public void transportEstablished(TransportCandidate local, TransportCandidate remote) throws NotConnectedException, InterruptedException {
|
||||
if (isFullyEstablished()) {
|
||||
|
||||
|
||||
// Indicate that this session is active.
|
||||
setSessionState(JingleSessionStateActive.getInstance());
|
||||
|
||||
|
||||
for (ContentNegotiator contentNegotiator : contentNegotiators) {
|
||||
if (contentNegotiator.getNegotiatorState() == JingleNegotiatorState.SUCCEEDED)
|
||||
contentNegotiator.triggerContentEstablished();
|
||||
}
|
||||
|
||||
if (getSessionState().equals(JingleSessionStatePending.getInstance())) {
|
||||
|
||||
|
||||
Jingle jout = new Jingle(JingleActionEnum.SESSION_ACCEPT);
|
||||
|
||||
// Build up a response packet from each media manager.
|
||||
|
@ -1109,7 +1109,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
|
||||
// Give each of the content negotiators a chance to start
|
||||
// and return a portion of the structure to make the Jingle packet.
|
||||
|
||||
|
||||
// Don't do this anymore. The problem is that the other side might not be ready.
|
||||
// Later when we receive our first jingle packet from the other side we'll fire-up the negotiators
|
||||
// before processing it. (See receivePacketAndRespond() above.
|
||||
|
@ -1125,9 +1125,9 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
|
||||
//updatePacketListener();
|
||||
}
|
||||
|
||||
|
||||
protected void doStart() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1142,7 +1142,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
transNeg.start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The jingle session may have one or more media managers that are trying to establish media sessions.
|
||||
* When the media manager succeeds in creating a media session is registers it with the session by the
|
||||
|
@ -1151,7 +1151,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
|||
public void addJingleMediaSession(String mediaManagerName, JingleMediaSession mediaSession) {
|
||||
mediaSessionMap.put(mediaManagerName, mediaSession);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The jingle session may have one or more media managers that are trying to establish media sessions.
|
||||
* When the media manager succeeds in creating a media session is registers it with the session by the
|
||||
|
|
|
@ -86,7 +86,7 @@ public class JingleSessionStateActive extends JingleSessionState {
|
|||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Receive and process the <session-terminate> action.
|
||||
*/
|
||||
|
@ -103,5 +103,5 @@ public class JingleSessionStateActive extends JingleSessionState {
|
|||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.jivesoftware.smackx.jingleold.packet.JingleError;
|
|||
* @see JingleSessionState
|
||||
*/
|
||||
public class JingleSessionStateEnded extends JingleSessionState {
|
||||
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(JingleSessionStateEnded.class.getName());
|
||||
|
||||
private static JingleSessionStateEnded INSTANCE = null;
|
||||
|
@ -64,7 +64,7 @@ public class JingleSessionStateEnded extends JingleSessionState {
|
|||
*/
|
||||
public IQ processJingle(JingleSession session, Jingle jingle, JingleActionEnum action) {
|
||||
IQ response = null;
|
||||
|
||||
|
||||
response = session.createJingleError(jingle, JingleError.MALFORMED_STANZA);
|
||||
|
||||
return response;
|
||||
|
|
|
@ -26,5 +26,5 @@ import org.jivesoftware.smackx.jingleold.JingleSession;
|
|||
public interface CreatedJingleSessionListener {
|
||||
|
||||
public void sessionCreated(JingleSession jingleSession);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -81,5 +81,5 @@ public interface JingleSessionListener extends JingleListener {
|
|||
* @param participant description of the participant
|
||||
*/
|
||||
public void sessionMediaReceived(JingleSession jingleSession, String participant);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ import java.util.List;
|
|||
* @author Thiago Camargo
|
||||
*/
|
||||
public abstract class JingleMediaManager {
|
||||
|
||||
|
||||
public static final String MEDIA_NAME = "JingleMediaManager";
|
||||
|
||||
// Each media manager must keep track of the transport manager that it uses.
|
||||
|
@ -42,7 +42,7 @@ public abstract class JingleMediaManager {
|
|||
public JingleMediaManager(JingleTransportManager transportManager) {
|
||||
this.transportManager = transportManager;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return The transport manager that goes with this media manager.
|
||||
*/
|
||||
|
@ -76,7 +76,7 @@ public abstract class JingleMediaManager {
|
|||
*/
|
||||
public abstract JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote,
|
||||
final TransportCandidate local, JingleSession jingleSession);
|
||||
|
||||
|
||||
// This is to set the attributes of the <content> element of the Jingle packet.
|
||||
public String getName() {
|
||||
return MEDIA_NAME;
|
||||
|
|
|
@ -213,10 +213,10 @@ public class MediaNegotiator extends JingleNegotiator {
|
|||
bestCommonAudioPt = calculateBestCommonAudioPt(offeredPayloads);
|
||||
|
||||
if (bestCommonAudioPt == null) {
|
||||
|
||||
|
||||
setNegotiatorState(JingleNegotiatorState.FAILED);
|
||||
response = session.createJingleError(jingle, JingleError.NEGOTIATION_ERROR);
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
setNegotiatorState(JingleNegotiatorState.SUCCEEDED);
|
||||
|
@ -242,7 +242,7 @@ public class MediaNegotiator extends JingleNegotiator {
|
|||
|
||||
offeredPayloads = description.getAudioPayloadTypesList();
|
||||
bestCommonAudioPt = calculateBestCommonAudioPt(offeredPayloads);
|
||||
|
||||
|
||||
synchronized (remoteAudioPts) {
|
||||
remoteAudioPts.addAll(offeredPayloads);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ package org.jivesoftware.smackx.jingleold.media;
|
|||
public class PayloadType {
|
||||
|
||||
public static final String NODENAME = "payload-type";
|
||||
|
||||
|
||||
public static int MAX_FIXED_PT = 95;
|
||||
|
||||
public static int INVALID_PT = 65535;
|
||||
|
@ -195,7 +195,7 @@ public class PayloadType {
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the XML element name of the element.
|
||||
*
|
||||
|
@ -204,7 +204,7 @@ public class PayloadType {
|
|||
public static String getElementName() {
|
||||
return NODENAME;
|
||||
}
|
||||
|
||||
|
||||
public String toXML() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
|
||||
|
@ -224,10 +224,10 @@ public class PayloadType {
|
|||
buf.append(getChildAttributes());
|
||||
}
|
||||
buf.append("/>");
|
||||
|
||||
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
|
||||
protected String getChildAttributes() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
if (this instanceof PayloadType.Audio) {
|
||||
|
@ -235,7 +235,7 @@ public class PayloadType {
|
|||
|
||||
buf.append(" clockrate=\"").append(pta.getClockRate()).append("\" ");
|
||||
}
|
||||
|
||||
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ import org.jivesoftware.smackx.jingleold.media.JingleMediaSession;
|
|||
public class AudioChannel {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(AudioChannel.class.getName());
|
||||
|
||||
|
||||
private MediaLocator locator;
|
||||
private String localIpAddress;
|
||||
private String remoteIpAddress;
|
||||
|
@ -215,7 +215,7 @@ public class AudioChannel {
|
|||
if (!result){
|
||||
return "Couldn't configure processor";
|
||||
}
|
||||
|
||||
|
||||
// Get the tracks from the processor
|
||||
TrackControl[] tracks = processor.getTrackControls();
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ public class JmfMediaManager extends JingleMediaManager {
|
|||
|
||||
public static final String MEDIA_NAME = "JMF";
|
||||
|
||||
|
||||
|
||||
private List<PayloadType> payloads = new ArrayList<PayloadType>();
|
||||
private String mediaLocator = null;
|
||||
|
||||
|
@ -159,7 +159,7 @@ public class JmfMediaManager extends JingleMediaManager {
|
|||
private static void runLinuxPreInstall() {
|
||||
// @TODO Implement Linux Pre-Install
|
||||
}
|
||||
|
||||
|
||||
public String getName() {
|
||||
return MEDIA_NAME;
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ public class SpeexMediaManager extends JingleMediaManager {
|
|||
private static void runLinuxPreInstall() {
|
||||
// @TODO Implement Linux Pre-Install
|
||||
}
|
||||
|
||||
|
||||
public String getName() {
|
||||
return MEDIA_NAME;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public class MultiMediaManager extends JingleMediaManager {
|
|||
public void setPreferredPayloadType(PayloadType preferredPayloadType) {
|
||||
this.preferredPayloadType = preferredPayloadType;
|
||||
}
|
||||
|
||||
|
||||
public String getName() {
|
||||
return MEDIA_NAME;
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ public class ScreenShareMediaManager extends JingleMediaManager {
|
|||
public void setEncoder(ImageEncoder encoder) {
|
||||
this.encoder = encoder;
|
||||
}
|
||||
|
||||
|
||||
public String getName() {
|
||||
return MEDIA_NAME;
|
||||
}
|
||||
|
|
|
@ -34,11 +34,11 @@ public abstract class AbstractBufferedImageOp implements BufferedImageOp, Clonea
|
|||
dstCM = src.getColorModel();
|
||||
return new BufferedImage(dstCM, dstCM.createCompatibleWritableRaster(src.getWidth(), src.getHeight()), dstCM.isAlphaPremultiplied(), null);
|
||||
}
|
||||
|
||||
|
||||
public Rectangle2D getBounds2D( BufferedImage src ) {
|
||||
return new Rectangle(0, 0, src.getWidth(), src.getHeight());
|
||||
}
|
||||
|
||||
|
||||
public Point2D getPoint2D( Point2D srcPt, Point2D dstPt ) {
|
||||
if ( dstPt == null )
|
||||
dstPt = new Point2D.Double();
|
||||
|
|
|
@ -48,7 +48,7 @@ public class OctTreeQuantizer implements Quantizer {
|
|||
int totalGreen;
|
||||
int totalBlue;
|
||||
int index;
|
||||
|
||||
|
||||
/**
|
||||
* A debugging method which prints the tree out.
|
||||
*/
|
||||
|
@ -72,7 +72,7 @@ public class OctTreeQuantizer implements Quantizer {
|
|||
private int maximumColors;
|
||||
private int colors = 0;
|
||||
private Vector<OctTreeNode>[] colorList;
|
||||
|
||||
|
||||
public OctTreeQuantizer() {
|
||||
setup(256);
|
||||
colorList = new Vector[MAX_LEVEL+1];
|
||||
|
@ -89,7 +89,7 @@ public class OctTreeQuantizer implements Quantizer {
|
|||
maximumColors = numColors;
|
||||
reduceColors = Math.max(512, numColors * 2);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add pixels to the quantizer.
|
||||
* @param pixels the array of ARGB pixels
|
||||
|
@ -241,7 +241,7 @@ public class OctTreeQuantizer implements Quantizer {
|
|||
buildColorTable(root, table, 0);
|
||||
return table;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A quick way to use the quantizer. Just create a table the right size and pass in the pixels.
|
||||
* @param inPixels the input colors
|
||||
|
@ -281,6 +281,6 @@ public class OctTreeQuantizer implements Quantizer {
|
|||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -64,14 +64,14 @@ public class PixelUtils {
|
|||
public static int interpolate(int v1, int v2, float f) {
|
||||
return clamp((int)(v1+f*(v2-v1)));
|
||||
}
|
||||
|
||||
|
||||
public static int brightness(int rgb) {
|
||||
int r = (rgb >> 16) & 0xff;
|
||||
int g = (rgb >> 8) & 0xff;
|
||||
int b = rgb & 0xff;
|
||||
return (r+g+b)/3;
|
||||
}
|
||||
|
||||
|
||||
public static boolean nearColors(int rgb1, int rgb2, int tolerance) {
|
||||
int r1 = (rgb1 >> 16) & 0xff;
|
||||
int g1 = (rgb1 >> 8) & 0xff;
|
||||
|
@ -81,19 +81,19 @@ public class PixelUtils {
|
|||
int b2 = rgb2 & 0xff;
|
||||
return Math.abs(r1-r2) <= tolerance && Math.abs(g1-g2) <= tolerance && Math.abs(b1-b2) <= tolerance;
|
||||
}
|
||||
|
||||
|
||||
private final static float[] hsb1 = new float[3];//FIXME-not thread safe
|
||||
private final static float[] hsb2 = new float[3];//FIXME-not thread safe
|
||||
|
||||
|
||||
// Return rgb1 painted onto rgb2
|
||||
public static int combinePixels(int rgb1, int rgb2, int op) {
|
||||
return combinePixels(rgb1, rgb2, op, 0xff);
|
||||
}
|
||||
|
||||
|
||||
public static int combinePixels(int rgb1, int rgb2, int op, int extraAlpha, int channelMask) {
|
||||
return (rgb2 & ~channelMask) | combinePixels(rgb1 & channelMask, rgb2, op, extraAlpha);
|
||||
}
|
||||
|
||||
|
||||
public static int combinePixels(int rgb1, int rgb2, int op, int extraAlpha) {
|
||||
if (op == REPLACE)
|
||||
return rgb1;
|
||||
|
|
|
@ -82,7 +82,7 @@ public class QuantizeFilter extends WholeImageFilter {
|
|||
public void setSerpentine(boolean serpentine) {
|
||||
this.serpentine = serpentine;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the serpentine setting
|
||||
* @return the current setting
|
||||
|
@ -90,7 +90,7 @@ public class QuantizeFilter extends WholeImageFilter {
|
|||
public boolean getSerpentine() {
|
||||
return serpentine;
|
||||
}
|
||||
|
||||
|
||||
public void quantize(int[] inPixels, int[] outPixels, int width, int height, int numColors, boolean dither, boolean serpentine) {
|
||||
int count = width*height;
|
||||
Quantizer quantizer = new OctTreeQuantizer();
|
||||
|
@ -165,7 +165,7 @@ public class QuantizeFilter extends WholeImageFilter {
|
|||
|
||||
protected int[] filterPixels( int width, int height, int[] inPixels, Rectangle transformedSpace ) {
|
||||
int[] outPixels = new int[width*height];
|
||||
|
||||
|
||||
quantize(inPixels, outPixels, width, height, numColors, dither, serpentine);
|
||||
|
||||
return outPixels;
|
||||
|
@ -174,5 +174,5 @@ public class QuantizeFilter extends WholeImageFilter {
|
|||
public String toString() {
|
||||
return "Colors/Quantize...";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public interface Quantizer {
|
|||
* @param numColors the number of colors we're quantizing to.
|
||||
*/
|
||||
public void setup(int numColors);
|
||||
|
||||
|
||||
/**
|
||||
* Add pixels to the quantizer.
|
||||
* @param pixels the array of ARGB pixels
|
||||
|
@ -35,13 +35,13 @@ public interface Quantizer {
|
|||
* @param count the count of pixels
|
||||
*/
|
||||
public 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();
|
||||
|
||||
|
||||
/**
|
||||
* Using the previously-built color table, return the index into that table for a pixel.
|
||||
* This is guaranteed to return a valid index - returning the index of a color closer
|
||||
|
|
|
@ -36,7 +36,7 @@ public abstract class WholeImageFilter extends AbstractBufferedImageOp {
|
|||
* The input image bounds.
|
||||
*/
|
||||
protected Rectangle originalSpace;
|
||||
|
||||
|
||||
/**
|
||||
* Construct a WholeImageFilter.
|
||||
*/
|
||||
|
@ -72,7 +72,7 @@ public abstract class WholeImageFilter extends AbstractBufferedImageOp {
|
|||
*/
|
||||
protected void transformSpace(Rectangle rect) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Actually filter the pixels.
|
||||
* @param width the image width
|
||||
|
|
|
@ -53,7 +53,7 @@ public class TestMediaSession extends JingleMediaSession {
|
|||
* Starts transmission and for NAT Traversal reasons start receiving also.
|
||||
*/
|
||||
public void startTrasmit() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -63,7 +63,7 @@ public class TestMediaSession extends JingleMediaSession {
|
|||
* @param active active state
|
||||
*/
|
||||
public void setTrasmit(boolean active) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,13 +77,13 @@ public class TestMediaSession extends JingleMediaSession {
|
|||
* Stops transmission and for NAT Traversal reasons stop receiving also.
|
||||
*/
|
||||
public void stopTrasmit() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* For NAT Reasons this method does nothing. Use startTransmit() to start transmit and receive jmf
|
||||
*/
|
||||
public void stopReceive() {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public class BasicResolver extends TransportResolver {
|
|||
|
||||
NetworkInterface iface = ifaces.nextElement();
|
||||
Enumeration<InetAddress> iaddresses = iface.getInetAddresses();
|
||||
|
||||
|
||||
while (iaddresses.hasMoreElements()) {
|
||||
InetAddress iaddress = iaddresses.nextElement();
|
||||
if (!iaddress.isLoopbackAddress() && !iaddress.isLinkLocalAddress() && !iaddress.isSiteLocalAddress()) {
|
||||
|
|
|
@ -27,9 +27,9 @@ import org.jivesoftware.smackx.jingleold.media.PayloadType;
|
|||
*
|
||||
*/
|
||||
public class FixedTransportManager extends JingleTransportManager implements JingleSessionListener, CreatedJingleSessionListener {
|
||||
|
||||
|
||||
FixedResolver resolver;
|
||||
|
||||
|
||||
public FixedTransportManager(FixedResolver inResolver) {
|
||||
resolver = inResolver;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class FixedTransportManager extends JingleTransportManager implements Jin
|
|||
protected TransportResolver createResolver(JingleSession session) {
|
||||
return resolver;
|
||||
}
|
||||
|
||||
|
||||
public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) {
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ public class FixedTransportManager extends JingleTransportManager implements Jin
|
|||
public void sessionMediaReceived(JingleSession jingleSession, String participant) {
|
||||
// Do Nothing
|
||||
}
|
||||
|
||||
|
||||
public void sessionCreated(JingleSession jingleSession) {
|
||||
jingleSession.addListener(this);
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class ICEResolver extends TransportResolver {
|
|||
if (negociatorsMap.get(server) == null) {
|
||||
ICENegociator iceNegociator = new ICENegociator(server, port, (short) 1);
|
||||
negociatorsMap.put(server, iceNegociator);
|
||||
|
||||
|
||||
// gather candidates
|
||||
iceNegociator.gatherCandidateAddresses();
|
||||
// priorize candidates
|
||||
|
@ -137,7 +137,7 @@ public class ICEResolver extends TransportResolver {
|
|||
} catch (SocketException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
TransportCandidate transportCandidate = new ICECandidate(candidate.getAddress().getInetAddress().getHostAddress(), 1, nicNum, String.valueOf(Math.abs(random.nextLong())), candidate.getPort(), "1", candidate.getPriority(), iceType);
|
||||
transportCandidate.setLocalIp(candidate.getBase().getAddress().getInetAddress().getHostAddress());
|
||||
transportCandidate.setPort(getFreePort());
|
||||
|
@ -166,8 +166,8 @@ public class ICEResolver extends TransportResolver {
|
|||
|
||||
String localIp;
|
||||
int network;
|
||||
|
||||
|
||||
|
||||
|
||||
// JBW/GW - 17JUL08: ICENegotiator.getPublicCandidate() always returned null in JSTUN 1.7.0, and now the API doesn't exist in JSTUN 1.7.1
|
||||
// if (iceNegociator.getPublicCandidate() != null) {
|
||||
// localIp = iceNegociator.getPublicCandidate().getBase().getAddress().getInetAddress().getHostAddress();
|
||||
|
|
|
@ -439,7 +439,7 @@ public class RTPBridge extends IQ {
|
|||
// return true;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
DiscoverInfo discoInfo = disco.discoverInfo(connection.getServiceName());
|
||||
for (DiscoverInfo.Identity identity : discoInfo.getIdentities()) {
|
||||
if ((identity.getName() != null) && (identity.getName().startsWith("rtpbridge"))) {
|
||||
|
|
|
@ -98,7 +98,7 @@ public class TcpUdpBridgeClient {
|
|||
|
||||
public void run() {
|
||||
try {
|
||||
|
||||
|
||||
InputStream in = localTcpSocket.getInputStream();
|
||||
InetAddress remoteHost = InetAddress.getByName(remoteUdpHost);
|
||||
process.start();
|
||||
|
|
|
@ -354,7 +354,7 @@ public abstract class TransportCandidate {
|
|||
public void run() {
|
||||
boolean isUsable;
|
||||
|
||||
|
||||
|
||||
try {
|
||||
InetAddress candAddress = InetAddress.getByName(getIp());
|
||||
isUsable = true;//candAddress.isReachable(TransportResolver.CHECK_TIMEOUT);
|
||||
|
|
|
@ -40,7 +40,7 @@ import org.jivesoftware.smackx.jingleold.JingleSession;
|
|||
public abstract class TransportResolver {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(TransportResolver.class.getName());
|
||||
|
||||
|
||||
public enum Type {
|
||||
|
||||
rawupd, ice
|
||||
|
@ -304,7 +304,7 @@ public abstract class TransportResolver {
|
|||
if (tpcan instanceof ICECandidate)
|
||||
cands.add((ICECandidate) tpcan);
|
||||
}
|
||||
|
||||
|
||||
// (ArrayList<ICECandidate>) getCandidatesList();
|
||||
if (cands.size() > 0) {
|
||||
Collections.sort(cands);
|
||||
|
|
|
@ -57,7 +57,7 @@ public class Jingle extends IQ {
|
|||
private Jid responder; // The responder
|
||||
|
||||
// Sub-elements of a Jingle object.
|
||||
|
||||
|
||||
private final List<JingleContent> contents = new ArrayList<JingleContent>();
|
||||
|
||||
private JingleContentInfo contentInfo;
|
||||
|
@ -353,7 +353,7 @@ public class Jingle extends IQ {
|
|||
buf.append(" sid=\"").append(getSid()).append("\"");
|
||||
}
|
||||
buf.append(">");
|
||||
|
||||
|
||||
synchronized (contents) {
|
||||
for (JingleContent content : contents) {
|
||||
buf.append(content.toXML());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue