Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用webRTC时AVCaptureSession崩溃_Webrtc_Avcapturesession - Fatal编程技术网

使用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你解决了这个问题吗?这里有相同的问题,有人找到了解决方案吗?