Fix peer connection

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2017-12-07 11:11:32 +01:00
parent d0e85c746b
commit 0ba40ce519
2 changed files with 6 additions and 7 deletions

View file

@ -171,7 +171,7 @@ public class CallActivity extends AppCompatActivity {
initViews();
PermissionHelper permissionHelper = new PermissionHelper(this);
permissionHelper.check(android.Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO,
permissionHelper.check(Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO,
Manifest.permission.MODIFY_AUDIO_SETTINGS, Manifest.permission.ACCESS_NETWORK_STATE,
Manifest.permission.ACCESS_WIFI_STATE, Manifest.permission.INTERNET)
.onSuccess(() -> {
@ -555,6 +555,7 @@ public class CallActivity extends AppCompatActivity {
endPeerConnection(magicPeerConnectionWrapperList.get(i).getSessionId());
}
for (MagicPeerConnectionWrapper magicPeerConnectionWrapper : magicPeerConnectionWrapperList) {
endPeerConnection(magicPeerConnectionWrapper.getSessionId());
}
@ -716,6 +717,9 @@ public class CallActivity extends AppCompatActivity {
if (remoteRenderersLayout.getChildCount() > 0) {
for (int i = 0; i < remoteRenderersLayout.getChildCount(); i++) {
if (remoteRenderersLayout.getChildAt(i).getTag().equals(sessionId)) {
SurfaceViewRenderer surfaceViewRenderer = remoteRenderersLayout.getChildAt(i).findViewById(R.id
.surface_view);
surfaceViewRenderer.release();
remoteRenderersLayout.removeViewAt(i);
remoteRenderersLayout.invalidate();
break;

View file

@ -47,7 +47,7 @@ import java.util.List;
public class MagicPeerConnectionWrapper {
private static String TAG = "MagicPeerConnectionWrapper";
private static PeerConnection peerConnection;
private PeerConnection peerConnection;
List<IceCandidate> iceCandidates = new ArrayList<>();
private List<PeerConnection.IceServer> iceServers;
private String sessionId;
@ -120,15 +120,10 @@ public class MagicPeerConnectionWrapper {
}
}
public PeerConnection getPeerConnection() {
return peerConnection;
}
public static void setPeerConnection(PeerConnection peerConnection) {
MagicPeerConnectionWrapper.peerConnection = peerConnection;
}
public String getSessionId() {
return sessionId;
}