parse candidates from session-init and session-accept
This commit is contained in:
parent
54ca3fb020
commit
a49d69c878
|
@ -49,14 +49,12 @@ import rocks.xmpp.addr.Jid;
|
|||
|
||||
public class JingleRtpConnection extends AbstractJingleConnection implements WebRTCWrapper.EventCallback {
|
||||
|
||||
private static final long BUSY_TIME_OUT = 30;
|
||||
|
||||
public static final List<State> STATES_SHOWING_ONGOING_CALL = Arrays.asList(
|
||||
State.PROCEED,
|
||||
State.SESSION_INITIALIZED_PRE_APPROVED,
|
||||
State.SESSION_ACCEPTED
|
||||
);
|
||||
|
||||
private static final long BUSY_TIME_OUT = 30;
|
||||
private static final List<State> TERMINATED = Arrays.asList(
|
||||
State.TERMINATED_SUCCESS,
|
||||
State.TERMINATED_DECLINED_OR_BUSY,
|
||||
|
@ -236,7 +234,20 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
|
|||
if (identificationTags.size() == 0) {
|
||||
Log.w(Config.LOGTAG, id.account.getJid().asBareJid() + ": no identification tags found in initial offer. we won't be able to calculate mLineIndices");
|
||||
}
|
||||
for (final Map.Entry<String, RtpContentMap.DescriptionTransport> content : contentMap.contents.entrySet()) {
|
||||
receiveCandidates(identificationTags, contentMap.contents.entrySet());
|
||||
} else {
|
||||
if (isTerminated()) {
|
||||
respondOk(jinglePacket);
|
||||
Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": ignoring out-of-order transport info; we where already terminated");
|
||||
} else {
|
||||
Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": received transport info while in state=" + this.state);
|
||||
terminateWithOutOfOrder(jinglePacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void receiveCandidates(final List<String> identificationTags, final Set<Map.Entry<String, RtpContentMap.DescriptionTransport>> contents) {
|
||||
for (final Map.Entry<String, RtpContentMap.DescriptionTransport> content : contents) {
|
||||
final String ufrag = content.getValue().transport.getAttribute("ufrag");
|
||||
for (final IceUdpTransportInfo.Candidate candidate : content.getValue().transport.getCandidates()) {
|
||||
final String sdp;
|
||||
|
@ -258,10 +269,6 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
|
|||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": received transport info while in state=" + this.state);
|
||||
terminateWithOutOfOrder(jinglePacket);
|
||||
}
|
||||
}
|
||||
|
||||
private void receiveSessionInitiate(final JinglePacket jinglePacket) {
|
||||
|
@ -302,6 +309,8 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
|
|||
}
|
||||
if (transition(target, () -> this.initiatorRtpContentMap = contentMap)) {
|
||||
respondOk(jinglePacket);
|
||||
final List<String> identificationTags = contentMap.group == null ? Collections.emptyList() : contentMap.group.getIdentificationTags();
|
||||
receiveCandidates(identificationTags, contentMap.contents.entrySet());
|
||||
if (target == State.SESSION_INITIALIZED_PRE_APPROVED) {
|
||||
Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": automatically accepting session-initiate");
|
||||
sendSessionAccept();
|
||||
|
@ -346,6 +355,8 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
|
|||
if (transition(State.SESSION_ACCEPTED)) {
|
||||
respondOk(jinglePacket);
|
||||
receiveSessionAccept(contentMap);
|
||||
final List<String> identificationTags = contentMap.group == null ? Collections.emptyList() : contentMap.group.getIdentificationTags();
|
||||
receiveCandidates(identificationTags, contentMap.contents.entrySet());
|
||||
} else {
|
||||
Log.d(Config.LOGTAG, String.format("%s: received session-accept while in state %s", id.account.getJid().asBareJid(), state));
|
||||
respondOk(jinglePacket);
|
||||
|
|
Loading…
Reference in New Issue