fix crash after session-accept failed and session-accept contained candidates

Conversations would attempt to feed any candidates found in the session-accept into
WebRTC; even if the session wasn’t setup correctly.

this commit processes the candidates only if the session was setup correctly

fixes #3867
This commit is contained in:
Daniel Gultsch 2020-08-22 08:11:21 +02:00
parent f3362ebde5
commit 15b323ee69

View file

@ -371,8 +371,6 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
if (transition(State.SESSION_ACCEPTED)) {
respondOk(jinglePacket);
receiveSessionAccept(contentMap);
final List<String> identificationTags = contentMap.group == null ? contentMap.getNames() : contentMap.group.getIdentificationTags();
processCandidates(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);
@ -390,7 +388,7 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
sendSessionTerminate(Reason.FAILED_APPLICATION, e.getMessage());
return;
}
org.webrtc.SessionDescription answer = new org.webrtc.SessionDescription(
final org.webrtc.SessionDescription answer = new org.webrtc.SessionDescription(
org.webrtc.SessionDescription.Type.ANSWER,
sessionDescription.toString()
);
@ -400,7 +398,10 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": unable to set remote description after receiving session-accept", Throwables.getRootCause(e));
webRTCWrapper.close();
sendSessionTerminate(Reason.FAILED_APPLICATION);
return;
}
final List<String> identificationTags = contentMap.group == null ? contentMap.getNames() : contentMap.group.getIdentificationTags();
processCandidates(identificationTags, contentMap.contents.entrySet());
}
private void sendSessionAccept() {