always use Camera2Enumerator

This commit is contained in:
Daniel Gultsch 2021-11-11 15:23:45 +01:00
parent 61851e5f84
commit 9843b72f6f

View file

@ -476,16 +476,8 @@ public class WebRTCWrapper {
requirePeerConnection().addIceCandidate(iceCandidate); requirePeerConnection().addIceCandidate(iceCandidate);
} }
private CameraEnumerator getCameraEnumerator() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return new Camera2Enumerator(requireContext());
} else {
return new Camera1Enumerator();
}
}
private Optional<CapturerChoice> getVideoCapturer() { private Optional<CapturerChoice> getVideoCapturer() {
final CameraEnumerator enumerator = getCameraEnumerator(); final CameraEnumerator enumerator = new Camera2Enumerator(requireContext());
final Set<String> deviceNames = ImmutableSet.copyOf(enumerator.getDeviceNames()); final Set<String> deviceNames = ImmutableSet.copyOf(enumerator.getDeviceNames());
for (final String deviceName : deviceNames) { for (final String deviceName : deviceNames) {
if (isFrontFacing(enumerator, deviceName)) { if (isFrontFacing(enumerator, deviceName)) {