I see this is a problem with iOS 14 beta, not XCode.
Post
Replies
Boosts
Views
Activity
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?
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)?
@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.
@bford I would send it through DTS request I raised. Thank you.
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:] ()
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.