Fix iOS8 crash in background mode.
Add system version check functionality in UIDevice+RTCDevice category. Check for iOS system version when handle capture session interruption. BUG=webrtc:7201 Review-Url: https://codereview.webrtc.org/2733773003 Cr-Commit-Position: refs/heads/master@{#17079}
This commit is contained in:
1
AUTHORS
1
AUTHORS
@ -12,6 +12,7 @@ Bridger Maxwell <bridgeyman@gmail.com>
|
||||
Christophe Dumez <ch.dumez@samsung.com>
|
||||
Cody Barnes <conceptgenesis@gmail.com>
|
||||
Colin Plumb
|
||||
Dmitry Lizin <sdkdimon@gmail.com>
|
||||
Eric Rescorla, RTFM Inc. <ekr@rtfm.com>
|
||||
Frederik Riedel, Frogg GmbH <frederik.riedel@frogg.io>
|
||||
Giji Gangadharan <giji.g@samsung.com>
|
||||
|
@ -13,6 +13,7 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#if TARGET_OS_IPHONE
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "WebRTC/UIDevice+RTCDevice.h"
|
||||
#endif
|
||||
|
||||
#import "RTCDispatcher+Private.h"
|
||||
@ -232,21 +233,23 @@
|
||||
NSString *reasonString = nil;
|
||||
#if defined(__IPHONE_9_0) && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \
|
||||
__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_9_0
|
||||
NSNumber *reason = notification.userInfo[AVCaptureSessionInterruptionReasonKey];
|
||||
if (reason) {
|
||||
switch (reason.intValue) {
|
||||
case AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableInBackground:
|
||||
reasonString = @"VideoDeviceNotAvailableInBackground";
|
||||
break;
|
||||
case AVCaptureSessionInterruptionReasonAudioDeviceInUseByAnotherClient:
|
||||
reasonString = @"AudioDeviceInUseByAnotherClient";
|
||||
break;
|
||||
case AVCaptureSessionInterruptionReasonVideoDeviceInUseByAnotherClient:
|
||||
reasonString = @"VideoDeviceInUseByAnotherClient";
|
||||
break;
|
||||
case AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableWithMultipleForegroundApps:
|
||||
reasonString = @"VideoDeviceNotAvailableWithMultipleForegroundApps";
|
||||
break;
|
||||
if ([UIDevice isIOS9OrLater]) {
|
||||
NSNumber *reason = notification.userInfo[AVCaptureSessionInterruptionReasonKey];
|
||||
if (reason) {
|
||||
switch (reason.intValue) {
|
||||
case AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableInBackground:
|
||||
reasonString = @"VideoDeviceNotAvailableInBackground";
|
||||
break;
|
||||
case AVCaptureSessionInterruptionReasonAudioDeviceInUseByAnotherClient:
|
||||
reasonString = @"AudioDeviceInUseByAnotherClient";
|
||||
break;
|
||||
case AVCaptureSessionInterruptionReasonVideoDeviceInUseByAnotherClient:
|
||||
reasonString = @"VideoDeviceInUseByAnotherClient";
|
||||
break;
|
||||
case AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableWithMultipleForegroundApps:
|
||||
reasonString = @"VideoDeviceNotAvailableWithMultipleForegroundApps";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -165,4 +165,12 @@
|
||||
return @"Unknown";
|
||||
}
|
||||
|
||||
+ (double)currentDeviceSystemVersion {
|
||||
return [self currentDevice].systemVersion.doubleValue;
|
||||
}
|
||||
|
||||
+ (BOOL)isIOS9OrLater {
|
||||
return [self currentDeviceSystemVersion] >= 9.0;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -59,5 +59,6 @@ typedef NS_ENUM(NSInteger, RTCDeviceType) {
|
||||
|
||||
+ (RTCDeviceType)deviceType;
|
||||
+ (NSString *)stringForDeviceType:(RTCDeviceType)deviceType;
|
||||
+ (BOOL)isIOS9OrLater;
|
||||
|
||||
@end
|
||||
|
Reference in New Issue
Block a user