summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/moz-patch-stack/0033.patch
blob: 88c0ca91512586f07c035b88eb0eeabd27324b8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
From: Paul Adenot <paul@paul.cx>
Date: Wed, 4 Nov 2020 13:03:00 +0000
Subject: Bug 1675042 - Put IR camera last in the device selection list, so
 that they are never the default. r=dminor

Differential Revision: https://phabricator.services.mozilla.com/D95764
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/754900ff2a2b1c32878baf3c76d7c0e8219419ff
---
 sdk/android/api/org/webrtc/Camera1Enumerator.java |  5 +++++
 sdk/android/api/org/webrtc/Camera2Enumerator.java | 12 ++++++++++++
 sdk/android/api/org/webrtc/CameraEnumerator.java  |  1 +
 3 files changed, 18 insertions(+)

diff --git a/sdk/android/api/org/webrtc/Camera1Enumerator.java b/sdk/android/api/org/webrtc/Camera1Enumerator.java
index fb1a21f323..4a1aacdb05 100644
--- a/sdk/android/api/org/webrtc/Camera1Enumerator.java
+++ b/sdk/android/api/org/webrtc/Camera1Enumerator.java
@@ -63,6 +63,11 @@ public class Camera1Enumerator implements CameraEnumerator {
     return info != null && info.facing == android.hardware.Camera.CameraInfo.CAMERA_FACING_BACK;
   }
 
+  @Override
+  public boolean isInfrared(String deviceName) {
+    return false;
+  }
+
   @Override
   public List<CaptureFormat> getSupportedFormats(String deviceName) {
     return getSupportedFormats(getCameraIndex(deviceName));
diff --git a/sdk/android/api/org/webrtc/Camera2Enumerator.java b/sdk/android/api/org/webrtc/Camera2Enumerator.java
index 456d8cd060..44e239ad8e 100644
--- a/sdk/android/api/org/webrtc/Camera2Enumerator.java
+++ b/sdk/android/api/org/webrtc/Camera2Enumerator.java
@@ -74,6 +74,18 @@ public class Camera2Enumerator implements CameraEnumerator {
         == CameraMetadata.LENS_FACING_BACK;
   }
 
+  @Override
+  public boolean isInfrared(String deviceName) {
+    CameraCharacteristics characteristics = getCameraCharacteristics(deviceName);
+
+    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
+      Integer colors = characteristics.get(CameraCharacteristics.SENSOR_INFO_COLOR_FILTER_ARRANGEMENT);
+      return colors != null && colors.equals(CameraCharacteristics.SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR);
+    }
+
+    return false;
+  }
+
   @Nullable
   @Override
   public List<CaptureFormat> getSupportedFormats(String deviceName) {
diff --git a/sdk/android/api/org/webrtc/CameraEnumerator.java b/sdk/android/api/org/webrtc/CameraEnumerator.java
index dc954b62e0..db34d542c8 100644
--- a/sdk/android/api/org/webrtc/CameraEnumerator.java
+++ b/sdk/android/api/org/webrtc/CameraEnumerator.java
@@ -18,6 +18,7 @@ public interface CameraEnumerator {
   public String[] getDeviceNames();
   public boolean isFrontFacing(String deviceName);
   public boolean isBackFacing(String deviceName);
+  public boolean isInfrared(String deviceName);
   public List<CaptureFormat> getSupportedFormats(String deviceName);
 
   public CameraVideoCapturer createCapturer(
-- 
2.34.1