mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 01:07:47 +00:00
Fall back to Camera1Enumerator on exceptions
If Camera2Enumerator.isSupported() throws, consider Camera2Enumerator to not be supported, log the Throwable, and use Camera1Enumerator instead. Before this patch, an exception thrown by Camera2Enumerator.isSupported would crash any Signal call (even if video was not enabled). Fixes #6537 // FREEBIE
This commit is contained in:
parent
2e8250f25e
commit
1c94137f7a
@ -273,10 +273,17 @@ public class PeerConnectionWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private @Nullable CameraVideoCapturer createVideoCapturer(@NonNull Context context) {
|
private @Nullable CameraVideoCapturer createVideoCapturer(@NonNull Context context) {
|
||||||
Log.w(TAG, "Camera2 enumerator supported: " + Camera2Enumerator.isSupported(context));
|
boolean camera2EnumeratorIsSupported = false;
|
||||||
|
try {
|
||||||
|
camera2EnumeratorIsSupported = Camera2Enumerator.isSupported(context);
|
||||||
|
} catch (final Throwable throwable) {
|
||||||
|
Log.w(TAG, "Camera2Enumator.isSupport() threw.", throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.w(TAG, "Camera2 enumerator supported: " + camera2EnumeratorIsSupported);
|
||||||
CameraEnumerator enumerator;
|
CameraEnumerator enumerator;
|
||||||
|
|
||||||
if (Camera2Enumerator.isSupported(context)) enumerator = new Camera2Enumerator(context);
|
if (camera2EnumeratorIsSupported) enumerator = new Camera2Enumerator(context);
|
||||||
else enumerator = new Camera1Enumerator(true);
|
else enumerator = new Camera1Enumerator(true);
|
||||||
|
|
||||||
String[] deviceNames = enumerator.getDeviceNames();
|
String[] deviceNames = enumerator.getDeviceNames();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user