Index: webrtc/sdk/objc/Framework/Classes/avfoundationvideocapturer.mm |
diff --git a/webrtc/sdk/objc/Framework/Classes/avfoundationvideocapturer.mm b/webrtc/sdk/objc/Framework/Classes/avfoundationvideocapturer.mm |
index 1915538f240c242ec392b3a5a6984016af66aa4c..337b13aa8f8d415d0a66a12bd6886edf46d03bcc 100644 |
--- a/webrtc/sdk/objc/Framework/Classes/avfoundationvideocapturer.mm |
+++ b/webrtc/sdk/objc/Framework/Classes/avfoundationvideocapturer.mm |
@@ -114,6 +114,10 @@ static cricket::VideoFormat const kIPhone4SFormat = |
selector:@selector(handleCaptureSessionInterruptionEnded:) |
name:AVCaptureSessionInterruptionEndedNotification |
object:_captureSession]; |
+ [center addObserver:self |
+ selector:@selector(handleApplicationDidBecomeActive:) |
+ name:UIApplicationDidBecomeActiveNotification |
+ object:[UIApplication sharedApplication]]; |
#endif |
[center addObserver:self |
selector:@selector(handleCaptureSessionRuntimeError:) |
@@ -351,6 +355,22 @@ static cricket::VideoFormat const kIPhone4SFormat = |
}]; |
} |
+#if TARGET_OS_IPHONE |
+ |
+#pragma mark - UIApplication notifications |
+ |
+- (void)handleApplicationDidBecomeActive:(NSNotification *)notification { |
+ [RTCDispatcher dispatchAsyncOnType:RTCDispatcherTypeCaptureSession |
+ block:^{ |
+ if (self.hasStarted && !self.captureSession.isRunning) { |
+ RTCLog(@"Restarting capture session on active."); |
+ [self.captureSession startRunning]; |
+ } |
+ }]; |
+} |
+ |
+#endif // TARGET_OS_IPHONE |
+ |
#pragma mark - Private |
- (BOOL)setupCaptureSession { |