Change summary
src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java | 12 ++
1 file changed, 10 insertions(+), 2 deletions(-)
Detailed changes
@@ -764,14 +764,14 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
//paint local view over remote view
binding.localVideo.setZOrderMediaOverlay(true);
binding.localVideo.setMirror(requireRtpConnection().isFrontCamera());
- localVideoTrack.get().addSink(binding.localVideo);
+ addSink(localVideoTrack.get(), binding.localVideo);
} else {
binding.localVideo.setVisibility(View.GONE);
}
final Optional<VideoTrack> remoteVideoTrack = getRemoteVideoTrack();
if (remoteVideoTrack.isPresent()) {
ensureSurfaceViewRendererIsSetup(binding.remoteVideo);
- remoteVideoTrack.get().addSink(binding.remoteVideo);
+ addSink(remoteVideoTrack.get(), binding.remoteVideo);
if (state == RtpEndUserState.CONNECTED) {
binding.appBarLayout.setVisibility(View.GONE);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
@@ -791,6 +791,14 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
}
}
+ private static void addSink(final VideoTrack videoTrack, final SurfaceViewRenderer surfaceViewRenderer) {
+ try {
+ videoTrack.addSink(surfaceViewRenderer);
+ } catch (final IllegalStateException e) {
+ Log.e(Config.LOGTAG,"possible race condition on trying to display video track. ignoring",e);
+ }
+ }
+
private Optional<VideoTrack> getLocalVideoTrack() {
final JingleRtpConnection connection = this.rtpConnectionReference != null ? this.rtpConnectionReference.get() : null;
if (connection == null) {