| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 - (void)captureOutput:(AVCaptureOutput *)captureOutput | 297 - (void)captureOutput:(AVCaptureOutput *)captureOutput |
| 298 didDropSampleBuffer:(CMSampleBufferRef)sampleBuffer | 298 didDropSampleBuffer:(CMSampleBufferRef)sampleBuffer |
| 299 fromConnection:(AVCaptureConnection *)connection { | 299 fromConnection:(AVCaptureConnection *)connection { |
| 300 RTCLogError(@"Dropped sample buffer."); | 300 RTCLogError(@"Dropped sample buffer."); |
| 301 } | 301 } |
| 302 | 302 |
| 303 #pragma mark - AVCaptureSession notifications | 303 #pragma mark - AVCaptureSession notifications |
| 304 | 304 |
| 305 - (void)handleCaptureSessionInterruption:(NSNotification *)notification { | 305 - (void)handleCaptureSessionInterruption:(NSNotification *)notification { |
| 306 NSString *reasonString = nil; | 306 NSString *reasonString = nil; |
| 307 #if defined(__IPHONE_9_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_9_0 | 307 #if defined(__IPHONE_9_0) && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) \ |
| 308 && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_9_0 |
| 308 NSNumber *reason = | 309 NSNumber *reason = |
| 309 notification.userInfo[AVCaptureSessionInterruptionReasonKey]; | 310 notification.userInfo[AVCaptureSessionInterruptionReasonKey]; |
| 310 if (reason) { | 311 if (reason) { |
| 311 switch (reason.intValue) { | 312 switch (reason.intValue) { |
| 312 case AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableInBackground
: | 313 case AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableInBackground
: |
| 313 reasonString = @"VideoDeviceNotAvailableInBackground"; | 314 reasonString = @"VideoDeviceNotAvailableInBackground"; |
| 314 break; | 315 break; |
| 315 case AVCaptureSessionInterruptionReasonAudioDeviceInUseByAnotherClient: | 316 case AVCaptureSessionInterruptionReasonAudioDeviceInUseByAnotherClient: |
| 316 reasonString = @"AudioDeviceInUseByAnotherClient"; | 317 reasonString = @"AudioDeviceInUseByAnotherClient"; |
| 317 break; | 318 break; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 } | 405 } |
| 405 }]; | 406 }]; |
| 406 } | 407 } |
| 407 | 408 |
| 408 #endif // TARGET_OS_IPHONE | 409 #endif // TARGET_OS_IPHONE |
| 409 | 410 |
| 410 #pragma mark - Private | 411 #pragma mark - Private |
| 411 | 412 |
| 412 - (BOOL)setupCaptureSession { | 413 - (BOOL)setupCaptureSession { |
| 413 AVCaptureSession *captureSession = [[AVCaptureSession alloc] init]; | 414 AVCaptureSession *captureSession = [[AVCaptureSession alloc] init]; |
| 414 #if defined(__IPHONE_7_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_7_0 | 415 #if defined(__IPHONE_7_0) && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) \ |
| 416 && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_7_0 |
| 415 NSString *version = [[UIDevice currentDevice] systemVersion]; | 417 NSString *version = [[UIDevice currentDevice] systemVersion]; |
| 416 if ([version integerValue] >= 7) { | 418 if ([version integerValue] >= 7) { |
| 417 captureSession.usesApplicationAudioSession = NO; | 419 captureSession.usesApplicationAudioSession = NO; |
| 418 } | 420 } |
| 419 #endif | 421 #endif |
| 420 | 422 |
| 421 // Add the output. | 423 // Add the output. |
| 422 AVCaptureVideoDataOutput *videoDataOutput = [self videoDataOutput]; | 424 AVCaptureVideoDataOutput *videoDataOutput = [self videoDataOutput]; |
| 423 if (![captureSession canAddOutput:videoDataOutput]) { | 425 if (![captureSession canAddOutput:videoDataOutput]) { |
| 424 RTCLogError(@"Video data output unsupported."); | 426 RTCLogError(@"Video data output unsupported."); |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 buffer = rotated_buffer; | 758 buffer = rotated_buffer; |
| 757 } | 759 } |
| 758 } | 760 } |
| 759 | 761 |
| 760 OnFrame(cricket::WebRtcVideoFrame(buffer, rotation, | 762 OnFrame(cricket::WebRtcVideoFrame(buffer, rotation, |
| 761 translated_camera_time_us, 0), | 763 translated_camera_time_us, 0), |
| 762 captured_width, captured_height); | 764 captured_width, captured_height); |
| 763 } | 765 } |
| 764 | 766 |
| 765 } // namespace webrtc | 767 } // namespace webrtc |
| OLD | NEW |