mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-29 18:08:58 +03:00
Safe guard against crashing
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
90b5055fb2
commit
02c115d49b
1 changed files with 14 additions and 10 deletions
|
@ -74,15 +74,18 @@ public class MagicPeerConnectionWrapper {
|
||||||
this.localSession = localSession;
|
this.localSession = localSession;
|
||||||
this.localMediaStream = mediaStream;
|
this.localMediaStream = mediaStream;
|
||||||
|
|
||||||
peerConnection = peerConnectionFactory.createPeerConnection(iceServerList, mediaConstraints,
|
|
||||||
new MagicPeerConnectionObserver());
|
|
||||||
peerConnection.addStream(localMediaStream);
|
|
||||||
|
|
||||||
this.sessionId = sessionId;
|
this.sessionId = sessionId;
|
||||||
this.mediaConstraints = mediaConstraints;
|
this.mediaConstraints = mediaConstraints;
|
||||||
|
|
||||||
magicSdpObserver = new MagicSdpObserver();
|
magicSdpObserver = new MagicSdpObserver();
|
||||||
hasInitiated = sessionId.compareTo(localSession) < 0;
|
hasInitiated = sessionId.compareTo(localSession) < 0;
|
||||||
|
|
||||||
|
peerConnection = peerConnectionFactory.createPeerConnection(iceServerList, mediaConstraints,
|
||||||
|
new MagicPeerConnectionObserver());
|
||||||
|
|
||||||
|
if (peerConnection != null) {
|
||||||
|
peerConnection.addStream(localMediaStream);
|
||||||
|
|
||||||
if (hasInitiated) {
|
if (hasInitiated) {
|
||||||
DataChannel.Init init = new DataChannel.Init();
|
DataChannel.Init init = new DataChannel.Init();
|
||||||
init.negotiated = false;
|
init.negotiated = false;
|
||||||
|
@ -91,6 +94,7 @@ public class MagicPeerConnectionWrapper {
|
||||||
peerConnection.createOffer(magicSdpObserver, mediaConstraints);
|
peerConnection.createOffer(magicSdpObserver, mediaConstraints);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void removePeerConnection() {
|
public void removePeerConnection() {
|
||||||
if (magicDataChannel != null) {
|
if (magicDataChannel != null) {
|
||||||
|
|
Loading…
Reference in a new issue