File: s0079.patch

package info (click to toggle)
firefox 147.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,683,484 kB
  • sloc: cpp: 7,607,246; javascript: 6,533,185; ansic: 3,775,227; python: 1,415,393; xml: 634,561; asm: 438,951; java: 186,241; sh: 62,752; makefile: 18,079; objc: 13,092; perl: 12,808; yacc: 4,583; cs: 3,846; pascal: 3,448; lex: 1,720; ruby: 1,003; php: 436; lisp: 258; awk: 247; sql: 66; sed: 54; csh: 10; exp: 6
file content (66 lines) | stat: -rw-r--r-- 3,094 bytes parent folder | download | duplicates (13)
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
From: Nico Grunbaum <na-g@nostrum.com>
Date: Wed, 15 Nov 2023 22:33:00 +0000
Subject: Bug 1863041 - P0 - add device filter control to
 RTCCameraVideoCapturer;r=pehrsons,webrtc-reviewers

I have filed this bug upstream: https://bugs.chromium.org/p/webrtc/issues/detail?id=15639

Differential Revision: https://phabricator.services.mozilla.com/D193172
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/91a763d768b74acc9cf4828f91a86df4a7b092ce
---
 .../capturer/RTCCameraVideoCapturer.h         |  5 ++++-
 .../capturer/RTCCameraVideoCapturer.m         | 19 +++++++++++++++----
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/sdk/objc/components/capturer/RTCCameraVideoCapturer.h b/sdk/objc/components/capturer/RTCCameraVideoCapturer.h
index 5185fa866e..6aeb577b13 100644
--- a/sdk/objc/components/capturer/RTCCameraVideoCapturer.h
+++ b/sdk/objc/components/capturer/RTCCameraVideoCapturer.h
@@ -26,7 +26,10 @@ RTC_OBJC_EXPORT
 @property(readonly, nonatomic) AVCaptureSession *captureSession;
 
 // Returns list of available capture devices that support video capture.
-+ (NSArray<AVCaptureDevice *> *)captureDevices;
++ (NSArray<AVCaptureDevice *> *)captureDevicesWithDeviceTypes:
+    (NSArray<AVCaptureDeviceType> *)deviceTypes;
+// Returns list of default capture devices types
++ (NSArray<AVCaptureDeviceType> *)defaultCaptureDeviceTypes;
 // Returns list of formats that are supported by this class for this device.
 + (NSArray<AVCaptureDeviceFormat *> *)supportedFormatsForDevice:
     (AVCaptureDevice *)device;
diff --git a/sdk/objc/components/capturer/RTCCameraVideoCapturer.m b/sdk/objc/components/capturer/RTCCameraVideoCapturer.m
index ff55bd7f19..60b1dbbfb5 100644
--- a/sdk/objc/components/capturer/RTCCameraVideoCapturer.m
+++ b/sdk/objc/components/capturer/RTCCameraVideoCapturer.m
@@ -124,16 +124,27 @@ const int64_t kNanosecondsPerSecond = 1000000000;
   [[NSNotificationCenter defaultCenter] removeObserver:self];
 }
 
-+ (NSArray<AVCaptureDevice *> *)captureDevices {
++ (NSArray<AVCaptureDevice *> *)captureDevicesWithDeviceTypes:
+    (NSArray<AVCaptureDeviceType> *)deviceTypes {
   AVCaptureDeviceDiscoverySession *session = [AVCaptureDeviceDiscoverySession
-      discoverySessionWithDeviceTypes:@[
-        AVCaptureDeviceTypeBuiltInWideAngleCamera
-      ]
+      discoverySessionWithDeviceTypes:deviceTypes
                             mediaType:AVMediaTypeVideo
                              position:AVCaptureDevicePositionUnspecified];
   return session.devices;
 }
 
++ (NSArray<AVCaptureDeviceType> *)defaultCaptureDeviceTypes {
+  NSArray *types = @[ AVCaptureDeviceTypeBuiltInWideAngleCamera ];
+#if !defined(WEBRTC_IOS)
+  if (@available(macOS 14.0, *)) {
+    types = [types arrayByAddingObject:AVCaptureDeviceTypeExternal];
+  } else {
+    types = [types arrayByAddingObject:AVCaptureDeviceTypeExternalUnknown];
+  }
+#endif
+  return types;
+}
+
 + (NSArray<AVCaptureDeviceFormat *> *)supportedFormatsForDevice:
     (AVCaptureDevice *)device {
   // Support opening the device in any format. We make sure it's converted to a