使用webRTC时AVCaptureSession崩溃
我正在使用使用webRTC时AVCaptureSession崩溃,webrtc,avcapturesession,Webrtc,Avcapturesession,我正在使用WebRTC及其使用AVCaptureSession。它可以正常工作几次,但有时会因为这个异常而崩溃 断言失败:(_internal->figCaptureSession==NULL),函数 -[AVCaptureVideoPreviewLayer附件OFIGCaptureSession:],文件/BuildRoot/Library/Caches/com.apple.xbs/Sources/EmbeddedAVFoundation/EmbeddedAVFoundation-1187.3
WebRTC
及其使用AVCaptureSession
。它可以正常工作几次,但有时会因为这个异常而崩溃
断言失败:(_internal->figCaptureSession==NULL),函数
-[AVCaptureVideoPreviewLayer附件OFIGCaptureSession:],文件/BuildRoot/Library/Caches/com.apple.xbs/Sources/EmbeddedAVFoundation/EmbeddedAVFoundation-1187.37.2.1/Aspen/AVCaptureVideoPreviewLayer.m
我最近也有这个问题。在我的代码中,我保留了AVCaptureOutput的一个实例,并添加和删除了它。再次尝试将同一AVCaptureOutput实例添加到同一捕获会话时,出现此错误 我就是这样解决的:
private var _captureOutput: AVCaptureOutput?
var captureOutput: AVCaptureOutput {
guard let captureOutput = _captureOutput else {
let photoOutput = AVCapturePhotoOutput()
photoOutput.isHighResolutionCaptureEnabled = true
_captureOutput = photoOutput
return photoOutput
}
return captureOutput
}
在需要时初始化实例一次,在删除实例时也将其置零
captureSession.outputs.forEach { [weak self] output in
self?.captureSession.removeOutput(output)
self?._captureOutput = nil
}
在使用RTCCameraPreviewView实例之前,您必须禁用其captureSession,断言将消失。面临同样的问题。这里也是一样,只是随机发生,没有有用的调试信息。@Tina。你能添加更多的集成代码、版本WebRTC库和完整的stacktrace吗?@Tina你解决了这个问题吗?这里有相同的问题,有人找到了解决方案吗?