Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.8.1
-
None
-
iPad Air 13 M2, iOS 18.1.1
-
-
b27e3f102 (dev), 9d1e0cfc2 (dev), 4d8c8e0ff (6.8), ac4fea47f (6.8), ae69e229d (tqtc/lts-6.5), 97c968303 (tqtc/lts-6.5)
-
Multimedia wk 47-48, Multimedia wk 49-50
Description
When booting declarative-camera example on newest iOS version, the application crashes instantly. Relevant log from Xcode:
-[MTLTextureDescriptorInternal validateWithDevice:], line 1405: error 'Texture Descriptor Validation MTLTextureDescriptor has invalid pixelFormat (0). ' -[MTLTextureDescriptorInternal validateWithDevice:]:1405: failed assertion `Texture Descriptor Validation MTLTextureDescriptor has invalid pixelFormat (0). ' Message from debugger: killed Program ended with exit code: 9
The relevant line in the code is in "qffmpeghwaccel_videotoolbox.mm". Function "TextureSet *VideoToolBoxTextureConverter::getTextures(AVFrame *frame)". The offending statement:
// Create a CoreVideo pixel buffer backed Metal texture image from the texture cache.
auto ret = CVMetalTextureCacheCreateTextureFromImage(
kCFAllocatorDefault,
mtc(cvMetalTextureCache),
buffer, nil,
rhiTextureFormatToMetalFormat(textureDescription->textureFormat[plane]),
width, height,
plane,
&textureSet->cvMetalTexture[plane]);
This is because "rhiTextureFormatToMetalFormat" segfaults if we supply it a pixelFormat of value invalid.
My best guess so far is that iOS devices changed what kind of formats they favor to supply from the camera. My iPad device now only exposes formats of type NV12, and it seems we have no Metal code to handle this format.