How to fix 'OSStatus' is ambiguous without more context when using VTCompressionSessionEncodeFrame

188 views Asked by At

I have been trying to use VTCompressionSessionEncodeFrame to encode some CMSampleBuffers, but when I try to use it I always get this error: Expression type 'OSStatus' (aka 'Int32') is ambiguous without more context

I have tried to find out what it is but with no success, here is the code I am using:

var compressed = VTCompressionSessionEncodeFrame(session: vtCompressionSession, imageBuffer: imageBuff!, presentationTimeStamp: nil, duration: CMTime.invalid, frameProperties: nil, infoFlagsOut: infoFlags)

I do not reference the variable compressed anywhere else in the code as well.

All help is appreciated.

1

There are 1 answers

0
Asra On BEST ANSWER

I figured it out! I changed

var compressed = VTCompressionSessionEncodeFrame(session: vtCompressionSession, imageBuffer: imageBuff!, presentationTimeStamp: nil, duration: CMTime.invalid, frameProperties: nil, infoFlagsOut: infoFlags)

to

var output: VRCompressionOutputHandler? = nil
VTCompressionSessionEncodeFrame(session: vtCompressionSession, imageBuffer: imageBuff!, presentationTimeStamp: nil, duration: CMTime.invalid, frameProperties: nil, infoFlagsOut: infoFlags, outputHandler: output)