You were right, the multicam session was not released, KVO observation was holding it and that was copied from AVMultiCamPip sample code. I fixed the KVO observation and the multicam session is now released. But the problem never stops. I have the same AVCaptureVideoPreviewLayer that is passed between the two sessions and on stopping the multi cam session, deallocating it, and creating AVCaptureSession with default 1080p session preset now crashes the app. I am wondering if this piece of code of switching between sessions is bug free in AVFoundation. Assertion failed: (_internal->figCaptureSession == NULL), function -[AVCaptureVideoPreviewLayer attachToFigCaptureSession:]_block_invoke, file /Library/Caches/com.apple.xbs/Sources/EmbeddedAVFoundation/EmbeddedAVFoundation-1850.2/Aspen/Capture/Sources/AVCaptureVideoPreviewLayer.m, line 1082.
Post
Replies
Boosts
Views
Activity
And even if I set the videoPreviewLayer.session = nil after stopping session, I get crashes when I add AVCaptureVideoDataOutput:#10x00000001bdd83058 in KVO_IS_RETAINING_ALL_OBSERVERS_OF_THIS_OBJECT_IF_IT_CRASHES_AN_OBSERVER_WAS_OVERRELEASED_OR_SMASHED ()#20x00000001bdd80a20 in NSKeyValueWillChangeWithPerThreadPendingNotifications ()#30x00000001c7eff9ac in -[AVCaptureFigVideoDevice _setActiveFormat:resetVideoZoomFactorAndMinMaxFrameDurations:] ()#40x00000001c7f324f0 in -[AVCaptureSession _updateDeviceActiveFormatsAndActiveConnections] ()#50x00000001c7f31224 in -[AVCaptureSession _buildAndRunGraph] ()#60x00000001c7f2b174 in -[AVCaptureSession _commitConfiguration] ()#70x00000001c7f2ccec in -[AVCaptureSession addOutput:] ()
@bford I would send it through DTS request I raised. Thank you.
@bford, I am using AVMultiCamPip sample code as it is which uses front and back ports (not omnidirectional one). I also have sent a sample code to DTS with other AVCaptureMultiCamSession issues for your reference. Can also add few lines of code to the same and resend it for your reference.
Thanks for the response. Will this API work with RemoteIO Audio Unit as well to get raw audio samples in stereo format from the builtin mic? Also, will it be possible to get raw samples from both the Airpods in one Audio session (or atleast dynamically switch from one Airpod to another using AVAudioSession API)?
I also tried AVCaptureDiscoverSession
private var audioDiscoverySession = AVCaptureDevice.DiscoverySession(deviceTypes: [AVCaptureDevice.DeviceType.builtInMicrophone], mediaType: .audio, position: .unspecified)
And tried to grab the first device. Still, it is nil. Why?
I see this is a problem with iOS 14 beta, not XCode.
I found it eventually but this is driving me crazy to share projects between XCode11 and XCode12. At times I need XCode12 to test new iOS14 APIs but then XCode12 beta 3 is too buggy so coming back to XCode11 is painful. There are lot of code changes required to make the project compatible with XCode11. For instance, this code
if usingFrontCamera { preferredAutoMicrophoneOrientation = AVAudioSession.Orientation.front
} else { preferredAutoMicrophoneOrientation = AVAudioSession.Orientation.back
}
It requires a different approach altogether in XCode11. Setting it to AVAudioSession.Orientation.orientationFront doesn't work!
The problem happens on iOS 14 beta 3 as well. When using XCode 12 beta 3 and connecting the device to debugger, view controller doesn't autorotate. Using XCode11 solves the problem though, but I need XCode 12! Apple Engineers, are you aware of this issue?
I found the bug. This is caused by a single line of code such as	 public var metalDevice:MTLDevice? = MTLCreateSystemDefaultDevice()
Can't believe such a terrible bug is not encountered by anyone so far?
I found that setting GPU Frame Capture to "Disable" or "Metal" fixes it. The default choice in Scheme option is "Automatically Enabled" which is the culprit.
Dear Apple Engineers, thanks for replying. I found that tmp folder was growing by leaps and bounds and had to clear gigabytes of space by removing everything in tmp folder. My question now is why iOS never deleted storage in the tmp folder? Doesn't iOS periodically clear space in tmp folder?
Dear UIKit Engineers, This is a bug with XCode projects not having UISceneDelegate (pre iOS 13) and is very simple to reproduce. Just have an XCode project without UISceneDelegate and have a hidden subview with white background in the Storyboard. Unhide this subview in viewDidLoad and see the glitch on startup in landscape mode.
I have filed feedback FB8400870. Is there any known workaround? This is causing very bad app load experience.
FYI, the problem is more accurately described in the following SO link with images:
https://stackoverflow.com/questions/63418881/uikit-glitch-on-ios14-for-projects-without-uiscenedelegate
Dear UIKit Engineers,
Do you have any inputs on this, still looks unresolved on iOS14!