Index: webrtc/sdk/objc/Framework/Classes/UI/RTCCameraPreviewView.m |
diff --git a/webrtc/sdk/objc/Framework/Classes/UI/RTCCameraPreviewView.m b/webrtc/sdk/objc/Framework/Classes/UI/RTCCameraPreviewView.m |
index 5a60ba3e896ddd0585ab7746c261537faa46a9c6..8af3384e7f9f3645d837670e63bb54db52842432 100644 |
--- a/webrtc/sdk/objc/Framework/Classes/UI/RTCCameraPreviewView.m |
+++ b/webrtc/sdk/objc/Framework/Classes/UI/RTCCameraPreviewView.m |
@@ -27,11 +27,14 @@ |
if (_captureSession == captureSession) { |
return; |
} |
- _captureSession = captureSession; |
- AVCaptureVideoPreviewLayer *previewLayer = [self previewLayer]; |
- [RTCDispatcher dispatchAsyncOnType:RTCDispatcherTypeCaptureSession |
+ [RTCDispatcher dispatchAsyncOnType:RTCDispatcherTypeMain |
block:^{ |
- previewLayer.session = captureSession; |
+ _captureSession = captureSession; |
+ AVCaptureVideoPreviewLayer *previewLayer = [self previewLayer]; |
+ [RTCDispatcher dispatchAsyncOnType:RTCDispatcherTypeCaptureSession |
+ block:^{ |
+ previewLayer.session = captureSession; |
+ }]; |
}]; |
} |