10000 [macOS] Fix hot restart videoCapturer crash · izouxv/flutter-webrtc@5fac998 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5fac998

Browse files
committed
[macOS] Fix hot restart videoCapturer crash
If RTCVideoView with opened _localRenderer placed at root Widget, after hot restarting application was crashed with error: *** Assertion failure in -[RTCCameraVideoCapturer dealloc], ../../sdk/objc/components/capturer/RTCCameraVideoCapturer.m:113 *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Session was still running in RTCCameraVideoCapturer dealloc. Forgot to call stopCapture?'
1 parent bc8dc67 commit 5fac998

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

macos/Classes/FlutterRTCMediaStream.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,9 @@ - (void)getUserVideo:(NSDictionary *)constraints
290290

291291
if (videoDevice) {
292292
RTCVideoSource *videoSource = [self.peerConnectionFactory videoSource];
293+
if(self.videoCapturer){
294+
[self.videoCapturer stopCapture];
295+
}
293296
self.videoCapturer = [[RTCCameraVideoCapturer alloc] initWithDelegate:videoSource];
294297
AVCaptureDeviceFormat *selectedFormat = [self selectFormatForDevice:videoDevice];
295298
NSInteger selectedFps = [self selectFpsForFormat:selectedFormat];

0 commit comments

Comments
 (0)
0