catch ISE cause by race when displaying video track. fixes #3752
This commit is contained in:
parent
5e3aab3abe
commit
63ba21a512
|
@ -764,14 +764,14 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
|
||||||
//paint local view over remote view
|
//paint local view over remote view
|
||||||
binding.localVideo.setZOrderMediaOverlay(true);
|
binding.localVideo.setZOrderMediaOverlay(true);
|
||||||
binding.localVideo.setMirror(requireRtpConnection().isFrontCamera());
|
binding.localVideo.setMirror(requireRtpConnection().isFrontCamera());
|
||||||
localVideoTrack.get().addSink(binding.localVideo);
|
addSink(localVideoTrack.get(), binding.localVideo);
|
||||||
} else {
|
} else {
|
||||||
binding.localVideo.setVisibility(View.GONE);
|
binding.localVideo.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
final Optional<VideoTrack> remoteVideoTrack = getRemoteVideoTrack();
|
final Optional<VideoTrack> remoteVideoTrack = getRemoteVideoTrack();
|
||||||
if (remoteVideoTrack.isPresent()) {
|
if (remoteVideoTrack.isPresent()) {
|
||||||
ensureSurfaceViewRendererIsSetup(binding.remoteVideo);
|
ensureSurfaceViewRendererIsSetup(binding.remoteVideo);
|
||||||
remoteVideoTrack.get().addSink(binding.remoteVideo);
|
addSink(remoteVideoTrack.get(), binding.remoteVideo);
|
||||||
if (state == RtpEndUserState.CONNECTED) {
|
if (state == RtpEndUserState.CONNECTED) {
|
||||||
binding.appBarLayout.setVisibility(View.GONE);
|
binding.appBarLayout.setVisibility(View.GONE);
|
||||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
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() {
|
private Optional<VideoTrack> getLocalVideoTrack() {
|
||||||
final JingleRtpConnection connection = this.rtpConnectionReference != null ? this.rtpConnectionReference.get() : null;
|
final JingleRtpConnection connection = this.rtpConnectionReference != null ? this.rtpConnectionReference.get() : null;
|
||||||
if (connection == null) {
|
if (connection == null) {
|
||||||
|
|
Loading…
Reference in New Issue