Fix stuff

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2017-11-21 11:49:36 +01:00
parent c09e08c7fd
commit f00f01c175
2 changed files with 28 additions and 19 deletions

View File

@ -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");
}
}
}

View File

@ -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();
}
}