Fix / prevent camera switch if no second camera

This commit is contained in:
Valere 2020-06-20 09:50:32 +02:00
parent 64a67b57b8
commit 6b806922ee
1 changed files with 3 additions and 2 deletions

View File

@ -179,7 +179,7 @@ class WebRtcPeerConnectionManager @Inject constructor(
var remoteSurfaceRenderer: MutableList<WeakReference<SurfaceViewRenderer>> = ArrayList()
fun addIfNeeded(renderer: SurfaceViewRenderer?, list: MutableList<WeakReference<SurfaceViewRenderer>>) {
if (renderer == null) return
if (renderer == null) return
val exists = list.firstOrNull() {
it.get() == renderer
} != null
@ -189,7 +189,7 @@ class WebRtcPeerConnectionManager @Inject constructor(
}
fun removeIfNeeded(renderer: SurfaceViewRenderer?, list: MutableList<WeakReference<SurfaceViewRenderer>>) {
if (renderer == null) return
if (renderer == null) return
val exists = list.indexOfFirst {
it.get() == renderer
}
@ -736,6 +736,7 @@ class WebRtcPeerConnectionManager @Inject constructor(
fun switchCamera() {
Timber.v("## VOIP switchCamera")
if (!canSwitchCamera()) return
if (currentCall != null && currentCall?.mxCall?.state is CallState.Connected && currentCall?.mxCall?.isVideoCall == true) {
videoCapturer?.switchCamera(object : CameraVideoCapturer.CameraSwitchHandler {
// Invoked on success. |isFrontCamera| is true if the new camera is front facing.