From 92a38cc33f726067e53513a04d0fcb0e178f7fe5 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 29 Nov 2017 16:33:18 +0100 Subject: [PATCH] Fixed camera device switching during a video call --- .../org/linphone/call/CallVideoFragment.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/android/org/linphone/call/CallVideoFragment.java b/src/android/org/linphone/call/CallVideoFragment.java index b8482c67f..d8847d3f1 100644 --- a/src/android/org/linphone/call/CallVideoFragment.java +++ b/src/android/org/linphone/call/CallVideoFragment.java @@ -155,21 +155,20 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On String[] devices = LinphoneManager.getLc().getVideoDevicesList(); int index = 0; for (String d : devices) { - if (d == currentDevice) { + if (d.equals(currentDevice)) { break; } index++; } - String newDevice = devices[(index + 1) % devices.length]; + + String newDevice; + if (index == 1) + newDevice = devices[0]; + else + newDevice = devices[1]; LinphoneManager.getLc().setVideoDevice(newDevice); CallManager.getInstance().updateCall(); - - // previous call will cause graph reconstruction -> regive preview - // window - if (mCaptureView != null) { - LinphoneManager.getLc().setNativePreviewWindowId(mCaptureView); - } } catch (ArithmeticException ae) { Log.e("Cannot swtich camera : no camera"); }