Fixed crash on iOS13, methods beginGeneratingDeviceOrientationNotifications and endGeneratingDeviceOrientationNotifications.
1. On iOS13 the implementation of methods begin- and endGeneratingDeviceOrientationNotifications changed and now are looks like "not threadsafe" (in specific sence) - they should be called only on the main thread. This fact is not documented. And may be a mistake. 2. By the Apple official documentation methods begin- and endGeneratingDeviceOrientationNotifications should be balanced. (Each begin- method should be balanced with end- method.) By the reason two above facts they consequences merged and produced the "floating" NSInternalInconsistencyException crash. Bug: webrtc:11216 Change-Id: Ibedd5bba7476cc687de3b9b04be49e3cceac1d27 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/162205 Reviewed-by: Anders Carlsson <andersc@webrtc.org> Commit-Queue: Anders Carlsson <andersc@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30121}
This commit is contained in:
parent
4e64e60589
commit
f6b875c8a7
1
AUTHORS
1
AUTHORS
@ -6,6 +6,7 @@ Akshay Shah <meetakshay99@gmail.com>
|
||||
Alexander Brauckmann <a.brauckmann@gmail.com>
|
||||
Alexandre Gouaillard <agouaillard@gmail.com>
|
||||
Andrew MacDonald <andrew@webrtc.org>
|
||||
Andrey Efremov <yoklmnprst@ya.ru>
|
||||
Anil Kumar <an1kumar@gmail.com>
|
||||
Ben Strong <bstrong@gmail.com>
|
||||
Bob Withers <bwit@pobox.com>
|
||||
|
||||
@ -41,6 +41,7 @@ const int64_t kNanosecondsPerSecond = 1000000000;
|
||||
RTCVideoRotation _rotation;
|
||||
#if TARGET_OS_IPHONE
|
||||
UIDeviceOrientation _orientation;
|
||||
BOOL _generatingOrientationNotifications;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -158,7 +159,12 @@ const int64_t kNanosecondsPerSecond = 1000000000;
|
||||
RTCLogInfo("startCaptureWithDevice %@ @ %ld fps", format, (long)fps);
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (!self->_generatingOrientationNotifications) {
|
||||
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
|
||||
self->_generatingOrientationNotifications = YES;
|
||||
}
|
||||
});
|
||||
#endif
|
||||
|
||||
self.currentDevice = device;
|
||||
@ -200,7 +206,12 @@ const int64_t kNanosecondsPerSecond = 1000000000;
|
||||
[self.captureSession stopRunning];
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (self->_generatingOrientationNotifications) {
|
||||
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
|
||||
self->_generatingOrientationNotifications = NO;
|
||||
}
|
||||
});
|
||||
#endif
|
||||
self.isRunning = NO;
|
||||
if (completionHandler) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user