These simple lines of code (nothing else whatsoever in the app) work fine on iOS 9 (iPhone 6 and iPhone 4S), but not on iOS 8 (iPhone 5 and iPod Touch 5G):
VTCompressionSessionRef videoEncoder;
OSStatus err = VTCompressionSessionCreate(NULL, 1920, 1080,
kCMVideoCodecType_H264,
NULL,
NULL,
NULL,
NULL,
(__bridge void*)self, &videoEncoder);
if (err != noErr) {
NSLog(@"Error when creating compression session : %d", (int)err);
} else {
NSLog(@"All systems go!");
}
I have also tried with lower resolutions, tried providing some or all of the optional parameters, in all cases it works on iOS 9 and fails on iOS 8 with the error -12902 (kVTParameterErr). Nice to know that some parameter is wrong, but which one and why isn't it considered wrong on iOS 9?
Note that VTCopyVideoEncoderList does give me a list where the avc1 (H264) encoder is present in all cases also.
Any idea what's going on?