mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-23 06:42:05 +01:00
Echo Cancel Fixed
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7035 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
85387aa360
commit
a5a6697496
2 changed files with 59 additions and 38 deletions
|
@ -81,7 +81,7 @@ import java.util.Random;
|
|||
|
||||
/**
|
||||
* An abstract Jingle session.
|
||||
*
|
||||
* <p/>
|
||||
* This class contains some basic properties of every Jingle session. However,
|
||||
* the concrete implementation can be found in subclasses.
|
||||
*
|
||||
|
@ -344,21 +344,25 @@ public abstract class JingleSession extends JingleNegotiator {
|
|||
if (invalidState()) {
|
||||
throw new IllegalStateException(
|
||||
"Illegal state in dispatch packet in Session manager.");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (iq == null) {
|
||||
// If there is no input packet, then we must be inviting...
|
||||
jout = getState().eventInvite();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (iq.getType().equals(IQ.Type.ERROR)) {
|
||||
// Process errors
|
||||
getState().eventError(iq);
|
||||
} else if (iq.getType().equals(IQ.Type.RESULT)) {
|
||||
}
|
||||
else if (iq.getType().equals(IQ.Type.RESULT)) {
|
||||
// Process ACKs
|
||||
if (isExpectedId(iq.getPacketID())) {
|
||||
jout = getState().eventAck(iq);
|
||||
removeExpectedId(iq.getPacketID());
|
||||
}
|
||||
} else if (iq instanceof Jingle) {
|
||||
}
|
||||
else if (iq instanceof Jingle) {
|
||||
// It is not an error: it is a Jingle packet...
|
||||
Jingle jin = (Jingle) iq;
|
||||
Jingle.Action action = jin.getAction();
|
||||
|
@ -366,16 +370,21 @@ public abstract class JingleSession extends JingleNegotiator {
|
|||
if (action != null) {
|
||||
if (action.equals(Jingle.Action.SESSIONACCEPT)) {
|
||||
jout = getState().eventAccept(jin);
|
||||
} else if (action.equals(Jingle.Action.SESSIONINFO)) {
|
||||
}
|
||||
else if (action.equals(Jingle.Action.SESSIONINFO)) {
|
||||
jout = getState().eventInfo(jin);
|
||||
} else if (action.equals(Jingle.Action.SESSIONINITIATE)) {
|
||||
}
|
||||
else if (action.equals(Jingle.Action.SESSIONINITIATE)) {
|
||||
jout = getState().eventInitiate(jin);
|
||||
} else if (action.equals(Jingle.Action.SESSIONREDIRECT)) {
|
||||
}
|
||||
else if (action.equals(Jingle.Action.SESSIONREDIRECT)) {
|
||||
jout = getState().eventRedirect(jin);
|
||||
} else if (action.equals(Jingle.Action.SESSIONTERMINATE)) {
|
||||
}
|
||||
else if (action.equals(Jingle.Action.SESSIONTERMINATE)) {
|
||||
jout = getState().eventTerminate(jin);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
jout = errorMalformedStanza(iq);
|
||||
}
|
||||
}
|
||||
|
@ -469,7 +478,8 @@ public abstract class JingleSession extends JingleNegotiator {
|
|||
jSes.addTransports(jTrans.getTransportsList());
|
||||
|
||||
response = sendFormattedJingle(iq, jSes);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// If we don't have a valid session message, then we must send
|
||||
// separated messages for transport and jmf...
|
||||
if (jDesc != null) {
|
||||
|
@ -534,7 +544,8 @@ public abstract class JingleSession extends JingleNegotiator {
|
|||
if (jout.getTo() == null) {
|
||||
if (iq != null) {
|
||||
jout.setTo(iq.getFrom());
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
jout.setTo(other);
|
||||
}
|
||||
}
|
||||
|
@ -542,7 +553,8 @@ public abstract class JingleSession extends JingleNegotiator {
|
|||
if (jout.getFrom() == null) {
|
||||
if (iq != null) {
|
||||
jout.setFrom(iq.getTo());
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
jout.setFrom(me);
|
||||
}
|
||||
}
|
||||
|
@ -635,7 +647,8 @@ public abstract class JingleSession extends JingleNegotiator {
|
|||
if (jda.size() > 1) {
|
||||
throw new XMPPException(
|
||||
"Unsupported feature: the number of accepted content descriptions is greater than 1.");
|
||||
} else if (jda.size() == 1) {
|
||||
}
|
||||
else if (jda.size() == 1) {
|
||||
JingleContentDescription jd = (JingleContentDescription) jda.get(0);
|
||||
if (jd.getJinglePayloadTypesCount() > 1) {
|
||||
throw new XMPPException(
|
||||
|
@ -667,13 +680,15 @@ public abstract class JingleSession extends JingleNegotiator {
|
|||
if (jta.size() > 1) {
|
||||
throw new XMPPException(
|
||||
"Unsupported feature: the number of accepted transports is greater than 1.");
|
||||
} else if (jta.size() == 1) {
|
||||
}
|
||||
else if (jta.size() == 1) {
|
||||
org.jivesoftware.smackx.packet.JingleTransport jt = (org.jivesoftware.smackx.packet.JingleTransport) jta.get(0);
|
||||
|
||||
if (jt.getCandidatesCount() > 1) {
|
||||
throw new XMPPException(
|
||||
"Unsupported feature: the number of accepted transport candidates is greater than 1.");
|
||||
} else if (jt.getCandidatesCount() == 1) {
|
||||
}
|
||||
else if (jt.getCandidatesCount() == 1) {
|
||||
JingleTransportCandidate jtc = (JingleTransportCandidate) jt
|
||||
.getCandidatesList().get(0);
|
||||
acceptedLocalCandidate = jtc.getMediaTransport();
|
||||
|
@ -717,7 +732,8 @@ public abstract class JingleSession extends JingleNegotiator {
|
|||
if (other.initiator != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!initiator.equals(other.initiator)) {
|
||||
}
|
||||
else if (!initiator.equals(other.initiator)) {
|
||||
//Todo check behavior
|
||||
// return false;
|
||||
}
|
||||
|
@ -726,7 +742,8 @@ public abstract class JingleSession extends JingleNegotiator {
|
|||
if (other.responder != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!responder.equals(other.responder)) {
|
||||
}
|
||||
else if (!responder.equals(other.responder)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -734,7 +751,8 @@ public abstract class JingleSession extends JingleNegotiator {
|
|||
if (other.sid != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!sid.equals(other.sid)) {
|
||||
}
|
||||
else if (!sid.equals(other.sid)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -880,12 +898,14 @@ public abstract class JingleSession extends JingleNegotiator {
|
|||
System.out.println("Ignored Jingle(INI): " + iq.toXML());
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// We accept some non-Jingle IQ packets: ERRORs and ACKs
|
||||
if (iq.getType().equals(IQ.Type.SET)) {
|
||||
System.out.println("Ignored Jingle(TYPE): " + iq.toXML());
|
||||
return false;
|
||||
} else if (iq.getType().equals(IQ.Type.GET)) {
|
||||
}
|
||||
else if (iq.getType().equals(IQ.Type.GET)) {
|
||||
System.out.println("Ignored Jingle(TYPE): " + iq.toXML());
|
||||
return false;
|
||||
}
|
||||
|
@ -1000,7 +1020,8 @@ public abstract class JingleSession extends JingleNegotiator {
|
|||
sli.sessionEstablished(pt, rc, lc, this);
|
||||
}
|
||||
}
|
||||
lc.getCandidateEcho().cancel();
|
||||
if (lc.getCandidateEcho() != null)
|
||||
lc.removeCandidateEcho();
|
||||
if (jingleMediaManager != null) {
|
||||
jingleMediaSession = jingleMediaManager.createMediaSession(pt, rc, lc);
|
||||
if (jingleMediaSession != null) {
|
||||
|
@ -1063,7 +1084,8 @@ public abstract class JingleSession extends JingleNegotiator {
|
|||
sendFormattedJingle(jout);
|
||||
triggerSessionClosed("Closed Locally");
|
||||
close();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
throw new IllegalStateException("Session Not Started");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
|
||||
for (TransportCandidate candidate : offeredCandidates)
|
||||
if (candidate.getCandidateEcho() != null)
|
||||
candidate.getCandidateEcho().cancel();
|
||||
candidate.removeCandidateEcho();
|
||||
|
||||
}
|
||||
|
||||
|
@ -851,11 +851,10 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
for (TransportCandidate candidate : localCandidates) {
|
||||
TransportCandidate.CandidateEcho echo = candidate.getCandidateEcho();
|
||||
if (echo != null) {
|
||||
if (echo.test(InetAddress.getByName(ice.getId()), ice.getPort(), 300))
|
||||
if (echo.test(InetAddress.getByName(ice.getIp()), ice.getPort(), 500))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
InetAddress.getByName(tc.getIp()).isReachable(3000);
|
||||
DatagramSocket socket = new DatagramSocket(0);
|
||||
socket.connect(InetAddress.getByName(tc.getIp()), tc.getPort());
|
||||
|
|
Loading…
Reference in a new issue