Fix crash and warning in AppRTCDemo
Don't dismiss the presented view controller if it's already being dismissed to clear a warning about dismissing from a view controller while a dismiss is in progress. Remove the sample buffer delegate when capture is being stopped to avoid a crash when a delegate method is sent to a deallocated object. BUG=webrtc:4734 R=jiayl@webrtc.org, tkchin@webrtc.org Review URL: https://webrtc-codereview.appspot.com/54669004. Patch from Jon Hjelle <hjon@andyet.net>. Cr-Commit-Position: refs/heads/master@{#9430}
This commit is contained in:
		| @@ -142,6 +142,7 @@ static dispatch_queue_t kBackgroundQueue = nil; | |||||||
|   if (!_isRunning) { |   if (!_isRunning) { | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
|  |   [_videoOutput setSampleBufferDelegate:nil queue:nullptr]; | ||||||
|   AVCaptureSession* session = _captureSession; |   AVCaptureSession* session = _captureSession; | ||||||
|   dispatch_async(kBackgroundQueue, ^{ |   dispatch_async(kBackgroundQueue, ^{ | ||||||
|     [session stopRunning]; |     [session stopRunning]; | ||||||
|   | |||||||
| @@ -151,9 +151,11 @@ | |||||||
|   self.remoteVideoTrack = nil; |   self.remoteVideoTrack = nil; | ||||||
|   self.localVideoTrack = nil; |   self.localVideoTrack = nil; | ||||||
|   [_client disconnect]; |   [_client disconnect]; | ||||||
|  |   if (![self isBeingDismissed]) { | ||||||
|     [self.presentingViewController dismissViewControllerAnimated:YES |     [self.presentingViewController dismissViewControllerAnimated:YES | ||||||
|                                                       completion:nil]; |                                                       completion:nil]; | ||||||
|   } |   } | ||||||
|  | } | ||||||
|  |  | ||||||
| - (void)switchCamera { | - (void)switchCamera { | ||||||
|   RTCVideoSource* source = self.localVideoTrack.source; |   RTCVideoSource* source = self.localVideoTrack.source; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jon Hjelle
					Jon Hjelle