properly parse transport info and apply ice candidates after direct init
This commit is contained in:
parent
3e5e4e813b
commit
845b3d8a0e
|
@ -110,7 +110,7 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
|
||||||
Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": improperly formatted contents", e);
|
Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": improperly formatted contents", e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final RtpContentMap rtpContentMap = isInitiator() ? this.initiatorRtpContentMap : this.responderRtpContentMap;
|
final RtpContentMap rtpContentMap = isInitiator() ? this.responderRtpContentMap : this.initiatorRtpContentMap;
|
||||||
final Group originalGroup = rtpContentMap != null ? rtpContentMap.group : null;
|
final Group originalGroup = rtpContentMap != null ? rtpContentMap.group : null;
|
||||||
final List<String> identificationTags = originalGroup == null ? Collections.emptyList() : originalGroup.getIdentificationTags();
|
final List<String> identificationTags = originalGroup == null ? Collections.emptyList() : originalGroup.getIdentificationTags();
|
||||||
if (identificationTags.size() == 0) {
|
if (identificationTags.size() == 0) {
|
||||||
|
@ -123,11 +123,11 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
|
||||||
final String sdpMid = content.getKey();
|
final String sdpMid = content.getKey();
|
||||||
final int mLineIndex = identificationTags.indexOf(sdpMid);
|
final int mLineIndex = identificationTags.indexOf(sdpMid);
|
||||||
final IceCandidate iceCandidate = new IceCandidate(sdpMid, mLineIndex, sdp);
|
final IceCandidate iceCandidate = new IceCandidate(sdpMid, mLineIndex, sdp);
|
||||||
Log.d(Config.LOGTAG, "received candidate: " + iceCandidate);
|
|
||||||
if (isInState(State.SESSION_ACCEPTED)) {
|
if (isInState(State.SESSION_ACCEPTED)) {
|
||||||
|
Log.d(Config.LOGTAG, "received candidate: " + iceCandidate);
|
||||||
this.webRTCWrapper.addIceCandidate(iceCandidate);
|
this.webRTCWrapper.addIceCandidate(iceCandidate);
|
||||||
} else {
|
} else {
|
||||||
this.pendingIceCandidates.push(iceCandidate);
|
this.pendingIceCandidates.offer(iceCandidate);
|
||||||
Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": put ICE candidate on backlog");
|
Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": put ICE candidate on backlog");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -233,6 +233,7 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
this.webRTCWrapper.setRemoteDescription(sdp).get();
|
this.webRTCWrapper.setRemoteDescription(sdp).get();
|
||||||
|
addIceCandidatesFromBlackLog();
|
||||||
org.webrtc.SessionDescription webRTCSessionDescription = this.webRTCWrapper.createAnswer().get();
|
org.webrtc.SessionDescription webRTCSessionDescription = this.webRTCWrapper.createAnswer().get();
|
||||||
final SessionDescription sessionDescription = SessionDescription.parse(webRTCSessionDescription.description);
|
final SessionDescription sessionDescription = SessionDescription.parse(webRTCSessionDescription.description);
|
||||||
final RtpContentMap respondingRtpContentMap = RtpContentMap.of(sessionDescription);
|
final RtpContentMap respondingRtpContentMap = RtpContentMap.of(sessionDescription);
|
||||||
|
@ -245,6 +246,14 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addIceCandidatesFromBlackLog() {
|
||||||
|
while (!this.pendingIceCandidates.isEmpty()) {
|
||||||
|
final IceCandidate iceCandidate = this.pendingIceCandidates.poll();
|
||||||
|
this.webRTCWrapper.addIceCandidate(iceCandidate);
|
||||||
|
Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": added ICE candidate from back log " + iceCandidate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void sendSessionAccept(final RtpContentMap rtpContentMap) {
|
private void sendSessionAccept(final RtpContentMap rtpContentMap) {
|
||||||
this.responderRtpContentMap = rtpContentMap;
|
this.responderRtpContentMap = rtpContentMap;
|
||||||
this.transitionOrThrow(State.SESSION_ACCEPTED);
|
this.transitionOrThrow(State.SESSION_ACCEPTED);
|
||||||
|
|
Loading…
Reference in a new issue