Explorar el Código

Fix stuff

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic hace 7 años
padre
commit
f00f01c175

+ 25 - 14
app/src/main/java/com/nextcloud/talk/activities/CallActivity.java

@@ -446,7 +446,8 @@ public class CallActivity extends AppCompatActivity {
                             peerConnectionWrapper.addCandidate(iceCandidate);
                             break;
                         case "endOfCandidates":
-                            //peerConnectionWrapper.drainIceCandidates();
+                            peerConnectionWrapper.drainIceCandidates();
+                            peerConnectionWrapper.sendLocalCandidates();
                             break;
                         default:
                             break;
@@ -588,20 +589,30 @@ public class CallActivity extends AppCompatActivity {
 
     private void gotRemoteStream(MediaStream stream) {
         //we have remote video stream. add to the renderer.
-        if (stream.videoTracks.size() == 1 && stream.audioTracks.size() == 1) {
-            final VideoTrack videoTrack = stream.videoTracks.get(0);
-            AudioTrack audioTrack = stream.audioTracks.get(0);
-            runOnUiThread(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        remoteRenderer = new VideoRenderer(fullScreenVideoView);
-                        videoTrack.addRenderer(remoteRenderer);
-                    } catch (Exception e) {
-                        e.printStackTrace();
+        if (stream.videoTracks.size() < 2 && stream.audioTracks.size() < 2) {
+            if (stream.videoTracks.size() == 1) {
+
+                VideoTrack videoTrack = stream.videoTracks.get(0);
+                runOnUiThread(new Runnable() {
+                    @Override
+                    public void run() {
+                        if (stream.videoTracks.size() == 1) {
+                            try {
+                                remoteRenderer = new VideoRenderer(fullScreenVideoView);
+                                videoTrack.addRenderer(remoteRenderer);
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            }
+                        }
                     }
-                }
-            });
+                });
+
+            }
+
+            if (stream.audioTracks.size() == 1) {
+                AudioTrack audioTrack = stream.audioTracks.get(0);
+                Log.d("MARIO", "BL");
+            }
         }
 
     }

+ 3 - 5
app/src/main/java/com/nextcloud/talk/webrtc/PeerConnectionWrapper.java

@@ -152,11 +152,9 @@ public class PeerConnectionWrapper {
                                 ("offer"))) {
                     EventBus.getDefault().post(new SessionDescriptionSendEvent(peerConnection.getLocalDescription(), sessionId,
                             peerConnection.getLocalDescription().type.canonicalForm(), null));
-                } else {
-                    if (peerConnection.getRemoteDescription() != null) {
-                        drainIceCandidates();
-                        sendLocalCandidates();
-                    }
+                } else if (peerConnection.getRemoteDescription() != null) {
+                    drainIceCandidates();
+                    sendLocalCandidates();
                 }
             }