Ensure UIView.layer is accessed on main thread.

BUG=webrtc:7829

Review-Url: https://codereview.webrtc.org/3002583002
Cr-Commit-Position: refs/heads/master@{#19345}
This commit is contained in:
andersc
2017-08-15 00:36:00 -07:00
committed by Commit Bot
parent 3439c89358
commit c288dab6e2

View File

@ -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;
}];
}];
}