Allow disabling capture to texture on Camera1Enumerator using constructor parameter.
The plan is that the CameraEnumerationAndroid will in the future have
method called getEnumerator that will return an enumerator that can be
used to create CameraVideoCapturer objects. It will return
Camera2Enumerator if it is supported or else Camera1Enumerator. Some
apps want to capture to byte buffers which is no longer supported in the
camera2 version of CameraVideoCapturer. Camera1Enumerator constructed
with false parameter as captureToTexture will be returned to these apps.
BUG=webrtc:5519
R=magjed@webrtc.org
Review URL: https://codereview.webrtc.org/2071213003 .
Cr-Original-Commit-Position: refs/heads/master@{#13294}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: b52e81c05466c0d90622b65a4a0427b0329e7331
diff --git a/api/java/android/org/webrtc/Camera1Enumerator.java b/api/java/android/org/webrtc/Camera1Enumerator.java
index 13a5237..a021da2 100644
--- a/api/java/android/org/webrtc/Camera1Enumerator.java
+++ b/api/java/android/org/webrtc/Camera1Enumerator.java
@@ -25,6 +25,15 @@
// reference.
private static List<List<CaptureFormat>> cachedSupportedFormats;
+ private final boolean captureToTexture;
+
+ Camera1Enumerator() {
+ this(true /* captureToTexture */);
+ }
+
+ Camera1Enumerator(boolean captureToTexture) {
+ this.captureToTexture = captureToTexture;
+ }
public boolean isFrontFacing(String deviceName) {
android.hardware.Camera.CameraInfo info = getCameraInfo(getCameraIndex(deviceName));
@@ -38,7 +47,7 @@
public CameraVideoCapturer createCapturer(String deviceName,
CameraVideoCapturer.CameraEventsHandler eventsHandler) {
- return new VideoCapturerAndroid(deviceName, eventsHandler, true);
+ return new VideoCapturerAndroid(deviceName, eventsHandler, captureToTexture);
}
private static android.hardware.Camera.CameraInfo getCameraInfo(int index) {