create sdp string and set on peer connection
This commit is contained in:
parent
b1c0e93b34
commit
f264ef9f8b
|
@ -43,6 +43,7 @@ public class JingleRtpConnection extends AbstractJingleConnection {
|
|||
|
||||
private State state = State.NULL;
|
||||
private RtpContentMap initialRtpContentMap;
|
||||
private PeerConnection peerConnection;
|
||||
|
||||
|
||||
public JingleRtpConnection(JingleConnectionManager jingleConnectionManager, Id id, Jid initiator) {
|
||||
|
@ -63,6 +64,7 @@ public class JingleRtpConnection extends AbstractJingleConnection {
|
|||
}
|
||||
|
||||
private void receiveSessionInitiate(final JinglePacket jinglePacket) {
|
||||
Log.d(Config.LOGTAG,jinglePacket.toString());
|
||||
if (isInitiator()) {
|
||||
Log.d(Config.LOGTAG, String.format("%s: received session-initiate even though we were initiating", id.account.getJid().asBareJid()));
|
||||
//TODO respond with out-of-order
|
||||
|
@ -104,6 +106,31 @@ public class JingleRtpConnection extends AbstractJingleConnection {
|
|||
Log.d(Config.LOGTAG, "transport: " + descriptionTransport.transport);
|
||||
Log.d(Config.LOGTAG, "fingerprint " + iceUdpTransportInfo.getFingerprint());
|
||||
}
|
||||
setupWebRTC();
|
||||
org.webrtc.SessionDescription sessionDescription = new org.webrtc.SessionDescription(org.webrtc.SessionDescription.Type.OFFER, SessionDescription.of(contentMap).toString());
|
||||
Log.d(Config.LOGTAG, "debug print for sessionDescription:" + sessionDescription.description);
|
||||
this.peerConnection.setRemoteDescription(new SdpObserver() {
|
||||
@Override
|
||||
public void onCreateSuccess(org.webrtc.SessionDescription sessionDescription) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSetSuccess() {
|
||||
Log.d(Config.LOGTAG, "onSetSuccess() for setRemoteDescription");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateFailure(String s) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSetFailure(String s) {
|
||||
Log.d(Config.LOGTAG, "onSetFailure() for setRemoteDescription. " + s);
|
||||
|
||||
}
|
||||
}, sessionDescription);
|
||||
}
|
||||
|
||||
void deliveryMessage(final Jid from, final Element message) {
|
||||
|
@ -148,8 +175,9 @@ public class JingleRtpConnection extends AbstractJingleConnection {
|
|||
}
|
||||
|
||||
private void sendSessionInitiate() {
|
||||
setupWebRTC();
|
||||
Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": prepare session-initiate");
|
||||
setupWebRTC();
|
||||
createOffer();
|
||||
}
|
||||
|
||||
private void sendSessionInitiate(RtpContentMap rtpContentMap) {
|
||||
|
@ -211,7 +239,7 @@ public class JingleRtpConnection extends AbstractJingleConnection {
|
|||
stream.addTrack(audioTrack);
|
||||
|
||||
|
||||
PeerConnection peerConnection = peerConnectionFactory.createPeerConnection(Collections.emptyList(), new PeerConnection.Observer() {
|
||||
this.peerConnection = peerConnectionFactory.createPeerConnection(Collections.emptyList(), new PeerConnection.Observer() {
|
||||
@Override
|
||||
public void onSignalingChange(PeerConnection.SignalingState signalingState) {
|
||||
|
||||
|
@ -272,7 +300,10 @@ public class JingleRtpConnection extends AbstractJingleConnection {
|
|||
});
|
||||
|
||||
peerConnection.addStream(stream);
|
||||
}
|
||||
|
||||
private void createOffer() {
|
||||
Log.d(Config.LOGTAG, "createOffer()");
|
||||
peerConnection.createOffer(new SdpObserver() {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,7 +21,7 @@ public class SessionDescription {
|
|||
|
||||
private final static String LINE_DIVIDER = "\r\n";
|
||||
private final static String HARDCODED_MEDIA_PROTOCOL = "UDP/TLS/RTP/SAVPF"; //probably only true for DTLS-SRTP aka when we have a fingerprint
|
||||
private final static int HARDCODED_MEDIA_PORT = 1;
|
||||
private final static int HARDCODED_MEDIA_PORT = 9;
|
||||
private final static String HARDCODED_ICE_OPTIONS = "trickle renomination";
|
||||
private final static String HARDCODED_CONNECTION = "IN IP4 0.0.0.0";
|
||||
|
||||
|
@ -130,6 +130,8 @@ public class SessionDescription {
|
|||
final Group group = contentMap.group;
|
||||
if (group != null) {
|
||||
attributeMap.put("group", group.getSemantics() + " " + Joiner.on(' ').join(group.getIdentificationTags()));
|
||||
} else {
|
||||
Log.d(Config.LOGTAG,"group was null");
|
||||
}
|
||||
|
||||
//random additional attributes
|
||||
|
@ -196,7 +198,7 @@ public class SessionDescription {
|
|||
|
||||
}
|
||||
sessionDescriptionBuilder.setVersion(0);
|
||||
sessionDescriptionBuilder.setName(" ");
|
||||
sessionDescriptionBuilder.setName("-");
|
||||
sessionDescriptionBuilder.setMedia(mediaListBuilder.build());
|
||||
sessionDescriptionBuilder.setAttributes(attributeMap);
|
||||
|
||||
|
@ -224,6 +226,8 @@ public class SessionDescription {
|
|||
public String toString() {
|
||||
final StringBuilder s = new StringBuilder()
|
||||
.append("v=").append(version).append(LINE_DIVIDER)
|
||||
.append("o=- 8770656990916039506 2 IN IP4 127.0.0.1").append(LINE_DIVIDER) //what ever that means
|
||||
.append("t=0 0").append(LINE_DIVIDER)
|
||||
.append("s=").append(name).append(LINE_DIVIDER);
|
||||
appendAttributes(s, attributes);
|
||||
for (Media media : this.media) {
|
||||
|
|
|
@ -43,7 +43,8 @@ public class JinglePacket extends IqPacket {
|
|||
}
|
||||
|
||||
public Group getGroup() {
|
||||
final Element group = this.findChild("group", Namespace.JINGLE_APPS_GROUPING);
|
||||
final Element jingle = findChild("jingle", Namespace.JINGLE);
|
||||
final Element group = jingle.findChild("group", Namespace.JINGLE_APPS_GROUPING);
|
||||
return group == null ? null : Group.upgrade(group);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue