Hey Everyone,
So I set up my AVCaptureDataOutputSynchronizer in both Swift and ObjC and it seems to be working in Swift but not ObjC so I'm really confused...
In Swift:
if session.canAddOutput(depthDataOutput) {
session.addOutput(depthDataOutput)
depthDataOutput.setDelegate(self, callbackQueue: dataOutputQueue)
}
outputSynchronizer = AVCaptureDataOutputSynchronizer(dataOutputs: [videoDataOutput, depthDataOutput])
outputSynchronizer!.setDelegate(self, queue: dataOutputQueue)
In ObjC:
if ( [_captureSession canAddOutput:_depthOutput] ) {
[_captureSession addOutput:_depthOutput];
[_depthOutput setDelegate:self callbackQueue:_videoDataOutputQueue];
}
_outputSynchronizer = [[AVCaptureDataOutputSynchronizer alloc] initWithDataOutputs:@[_videoOut, _depthOutput]];
[_outputSynchronizer setDelegate:self queue:_videoDataOutputQueue];
However, the depth info is missing in the delegate call from the output synchronizer in ObjC. I am able to see the depthDataOutput and the connection is there. When I do a print out of the connections for the outputSynchronizer I see the Depth and Video connections after I set them.
When I do three print outs of the properties at a break point in the delegate call for the output synchronizer in Swift I see:
AVCaptureSynchronizedDataCollection: 0x1c00110d0 { VDO[ ]: 590624033353208, DDO[ ]: 590624033353208, } (Latency:0.079288)
AVCaptureSynchronizedDataCollection: 0x1c400e430 { VDO[ ]: 590624100018333, DDO[ ]: 590624100018333, } (Latency:0.082406)
AVCaptureSynchronizedDataCollection: 0x1c400ec90 { VDO[ ]: 590624166683708, DDO[ ]: 590624166683708, } (Latency:0.083006)
Whereas in ObjC I see:
AVCaptureSynchronizedDataCollection: 0x1c4006cf0 { VDO[ ]: 590519171543071, DDO[--]: , } (Latency:0.040787) AVCaptureDepthDataOutput: 0x1c002d560
AVCaptureSynchronizedDataCollection: 0x1c4007810 { VDO[ ]: 590519204872375, DDO[--]: , } (Latency:0.042135) AVCaptureDepthDataOutput: 0x1c002d560
AVCaptureSynchronizedDataCollection: 0x1c4007760 { VDO[ ]: 590519238205083, DDO[--]: , } (Latency:0.040983) AVCaptureDepthDataOutput: 0x1c002d560
So the Depth info is missing in the delegate call for some reason. So if anyone has any pointers to what I might be doing wrong I'd appreciate it!