Merge pull request #1207 from shogo4405/feature/dettach-camera

Detach camera device stream#attachCamera(nil)
This commit is contained in:
shogo4405 2023-05-27 12:56:03 +09:00 committed by GitHub
commit dd1899c8e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 5 deletions

View File

@ -132,6 +132,17 @@ final class IOVideoUnit: NSObject, IOUnit {
guard let mixer, self.capture.device != device else {
return
}
guard let device else {
mixer.mediaSync = .passthrough
mixer.session.beginConfiguration()
defer {
mixer.session.commitConfiguration()
}
capture.detachSession(mixer.session)
try capture.attachDevice(nil, videoUnit: self)
return
}
mixer.mediaSync = .video
mixer.session.beginConfiguration()
defer {
mixer.session.commitConfiguration()
@ -139,11 +150,6 @@ final class IOVideoUnit: NSObject, IOUnit {
setTorchMode(.on)
}
}
guard let device else {
mixer.mediaSync = .passthrough
return
}
mixer.mediaSync = .video
if multiCamCapture.device == device {
try multiCamCapture.attachDevice(nil, videoUnit: self)
}