@@ -175,8 +175,7 @@ - (void)startCaptureWithDevice:(AVCaptureDevice *)device
175
175
176
176
NSError *error = nil ;
177
177
if (![self .currentDevice lockForConfiguration: &error]) {
178
- RTCLogError (@" Failed to lock device %@ . Error: %@ " ,
179
- self.currentDevice ,
178
+ RTCLogError (@" Failed to lock device %@ . Error: %@ " , self.currentDevice ,
180
179
error.userInfo );
181
180
if (completionHandler) {
182
181
completionHandler (error);
@@ -187,6 +186,7 @@ - (void)startCaptureWithDevice:(AVCaptureDevice *)device
187
186
[self reconfigureCaptureSessionInput ];
188
187
[self updateDeviceCaptureFormat: format fps: fps];
189
188
[self updateVideoDataOutputPixelFormat: format];
189
+ [self updateZoomFactor ];
190
190
[self .captureSession startRunning ];
191
191
[self .currentDevice unlockForConfiguration ];
192
192
self.isRunning = YES ;
@@ -287,7 +287,7 @@ - (void)captureOutput:(AVCaptureOutput *)captureOutput
287
287
RTC_OBJC_TYPE (RTCCVPixelBuffer) *rtcPixelBuffer =
288
288
[[RTC_OBJC_TYPE (RTCCVPixelBuffer) alloc ] initWithPixelBuffer: pixelBuffer];
289
289
int64_t timeStampNs = CMTimeGetSeconds (CMSampleBufferGetPresentationTimeStamp (sampleBuffer)) *
290
- kNanosecondsPerSecond ;
290
+ kNanosecondsPerSecond ;
291
291
RTC_OBJC_TYPE (RTCVideoFrame) *videoFrame =
292
292
[[RTC_OBJC_TYPE (RTCVideoFrame) alloc ] initWithBuffer: rtcPixelBuffer
293
293
rotation: _rotation
@@ -417,8 +417,7 @@ - (void)handleApplicationDidBecomeActive:(NSNotification *)notification {
417
417
- (dispatch_queue_t )frameQueue {
418
418
if (!_frameQueue) {
419
419
_frameQueue = RTCDispatchQueueCreateWithTarget (
420
- " org.webrtc.cameravideocapturer.video" ,
421
- DISPATCH_QUEUE_SERIAL,
420
+ " org.webrtc.cameravideocapturer.video" , DISPATCH_QUEUE_SERIAL,
422
421
dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_HIGH, 0 ));
423
422
}
424
423
return _frameQueue;
@@ -500,6 +499,18 @@ - (void)updateDeviceCaptureFormat:(AVCaptureDeviceFormat *)format fps:(NSInteger
500
499
}
501
500
}
502
501
502
+ - (void )updateZoomFactor {
503
+ NSAssert ([RTC_OBJC_TYPE (RTCDispatcher) isOnQueueForType: RTCDispatcherTypeCaptureSession],
504
+ @" updateZoomFactor must be called on the capture queue." );
505
+
506
+ #if TARGET_OS_IOS || TARGET_OS_TV
507
+ CGFloat firstSwitchOverZoomFactor = 1.0 ;
508
+ NSNumber *first = _currentDevice.virtualDeviceSwitchOverVideoZoomFactors .firstObject ;
509
+ if (first != nil ) firstSwitchOverZoomFactor = first.doubleValue ;
510
+ _currentDevice.videoZoomFactor = firstSwitchOverZoomFactor;
511
+ #endif
512
+ }
513
+
503
514
- (void )reconfigureCaptureSessionInput {
504
515
NSAssert ([RTC_OBJC_TYPE (RTCDispatcher) isOnQueueForType: RTCDispatcherTypeCaptureSession],
505
516
@" reconfigureCaptureSessionInput must be called on the capture queue." );
0 commit comments