diff --git a/modules/audio_device/ios/audio_device_ios.mm b/modules/audio_device/ios/audio_device_ios.mm index 528e146068..f7a3934bba 100644 --- a/modules/audio_device/ios/audio_device_ios.mm +++ b/modules/audio_device/ios/audio_device_ios.mm @@ -83,18 +83,14 @@ static void LogDeviceInfo() { RTC_LOG(LS_INFO) << "LogDeviceInfo"; @autoreleasepool { RTC_LOG(LS_INFO) << " system name: " << ios::GetSystemName(); - RTC_LOG(LS_INFO) << " system version 1(2): " << ios::GetSystemVersionAsString(); - RTC_LOG(LS_INFO) << " system version 2(2): " << ios::GetSystemVersion(); + RTC_LOG(LS_INFO) << " system version: " << ios::GetSystemVersionAsString(); RTC_LOG(LS_INFO) << " device type: " << ios::GetDeviceType(); RTC_LOG(LS_INFO) << " device name: " << ios::GetDeviceName(); RTC_LOG(LS_INFO) << " process name: " << ios::GetProcessName(); RTC_LOG(LS_INFO) << " process ID: " << ios::GetProcessID(); RTC_LOG(LS_INFO) << " OS version: " << ios::GetOSVersionString(); RTC_LOG(LS_INFO) << " processing cores: " << ios::GetProcessorCount(); -#if defined(__IPHONE_9_0) && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \ - __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_9_0 RTC_LOG(LS_INFO) << " low power mode: " << ios::GetLowPowerModeEnabled(); -#endif #if TARGET_IPHONE_SIMULATOR RTC_LOG(LS_INFO) << " TARGET_IPHONE_SIMULATOR is defined"; #endif diff --git a/sdk/objc/Framework/Classes/Common/UIDevice+RTCDevice.mm b/sdk/objc/Framework/Classes/Common/UIDevice+RTCDevice.mm index 3120827ae8..b2cfb2094b 100644 --- a/sdk/objc/Framework/Classes/Common/UIDevice+RTCDevice.mm +++ b/sdk/objc/Framework/Classes/Common/UIDevice+RTCDevice.mm @@ -89,10 +89,6 @@ return [self currentDevice].systemVersion.doubleValue; } -+ (BOOL)isIOS9OrLater { - return [self currentDeviceSystemVersion] >= 9.0; -} - + (BOOL)isIOS11OrLater { return [self currentDeviceSystemVersion] >= 11.0; } diff --git a/sdk/objc/Framework/Classes/Common/helpers.mm b/sdk/objc/Framework/Classes/Common/helpers.mm index 44098451aa..657a4a22b6 100644 --- a/sdk/objc/Framework/Classes/Common/helpers.mm +++ b/sdk/objc/Framework/Classes/Common/helpers.mm @@ -24,12 +24,6 @@ namespace webrtc { namespace ios { -#if defined(WEBRTC_IOS) -bool isOperatingSystemAtLeastVersion(double version) { - return GetSystemVersion() >= version; -} -#endif - NSString* NSStringFromStdString(const std::string& stdString) { // std::string may contain null termination character so we construct // using length. @@ -74,19 +68,14 @@ std::string GetSystemVersionAsString() { return StdStringFromNSString(osVersion); } -double GetSystemVersion() { - static dispatch_once_t once_token; - static double system_version; - dispatch_once(&once_token, ^{ - system_version = [UIDevice currentDevice].systemVersion.doubleValue; - }); - return system_version; -} - std::string GetDeviceType() { NSString* deviceModel = [[UIDevice currentDevice] model]; return StdStringFromNSString(deviceModel); } + +bool GetLowPowerModeEnabled() { + return [NSProcessInfo processInfo].lowPowerModeEnabled; +} #endif std::string GetDeviceName() { @@ -117,19 +106,6 @@ int GetProcessorCount() { return [NSProcessInfo processInfo].processorCount; } -#if defined(__IPHONE_9_0) && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) \ - && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_9_0 -bool GetLowPowerModeEnabled() { - if (isOperatingSystemAtLeastVersion(9.0)) { - // lowPoweredModeEnabled is only available on iOS9+. - return [NSProcessInfo processInfo].lowPowerModeEnabled; - } - RTC_LOG(LS_WARNING) << "webrtc::ios::GetLowPowerModeEnabled() is not " - "supported. Requires at least iOS 9.0"; - return false; -} -#endif - } // namespace ios } // namespace webrtc diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCCameraVideoCapturer.m b/sdk/objc/Framework/Classes/PeerConnection/RTCCameraVideoCapturer.m index 86eda60189..7ee319f6f6 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCCameraVideoCapturer.m +++ b/sdk/objc/Framework/Classes/PeerConnection/RTCCameraVideoCapturer.m @@ -248,25 +248,22 @@ const int64_t kNanosecondsPerSecond = 1000000000; - (void)handleCaptureSessionInterruption:(NSNotification *)notification { NSString *reasonString = nil; -#if defined(__IPHONE_9_0) && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \ - __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_9_0 - 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; - } +#if TARGET_OS_IPHONE + 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 diff --git a/sdk/objc/Framework/Classes/Video/RTCAVFoundationVideoCapturerInternal.mm b/sdk/objc/Framework/Classes/Video/RTCAVFoundationVideoCapturerInternal.mm index 287ecdd71d..b3722b0551 100644 --- a/sdk/objc/Framework/Classes/Video/RTCAVFoundationVideoCapturerInternal.mm +++ b/sdk/objc/Framework/Classes/Video/RTCAVFoundationVideoCapturerInternal.mm @@ -267,25 +267,22 @@ - (void)handleCaptureSessionInterruption:(NSNotification *)notification { NSString *reasonString = nil; -#if defined(__IPHONE_9_0) && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \ - __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_9_0 - 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; - } +#if TARGET_OS_IPHONE + 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 diff --git a/sdk/objc/Framework/Headers/WebRTC/UIDevice+RTCDevice.h b/sdk/objc/Framework/Headers/WebRTC/UIDevice+RTCDevice.h index 9709e4f7dd..79d2db8c4a 100644 --- a/sdk/objc/Framework/Headers/WebRTC/UIDevice+RTCDevice.h +++ b/sdk/objc/Framework/Headers/WebRTC/UIDevice+RTCDevice.h @@ -63,7 +63,6 @@ typedef NS_ENUM(NSInteger, RTCDeviceType) { @interface UIDevice (RTCDevice) + (RTCDeviceType)deviceType; -+ (BOOL)isIOS9OrLater; + (BOOL)isIOS11OrLater; @end