Repository navigation
fix(export): throw on overlay exports on the iOS Simulator instead of crashing - #212
Merged
Merged
Conversation
… crashing
On the iOS 26.5 and 27.0 Simulators, AVVideoCompositionCoreAnimationTool's
renderer wraps AVFoundation's malloc-backed frames in an IOSurface, and
libxpc kills the app ("Attempt to pass a malloc(3)ed region to
xpc_shmem_create()"). The trap can't be caught, so refuse overlay exports
on the iOS Simulator with KadrError.exportFailed pointing to the Known
Platform Issues article.
Tests that export with overlays are skipped on the iOS Simulator; a
Simulator-only test checks the refusal.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the Simulator crash analysis (PR #210, docs PR #211).
Problem
On the iOS 26.5 and 27.0 Simulators, any export with overlays kills the app:
AVVideoCompositionCoreAnimationTool's renderer wraps AVFoundation'smalloc-backed frames in an IOSurface, and libxpc traps with "Attempt to pass a malloc(3)ed region to xpc_shmem_create()". The trap can't be caught. It also crashes any iOS Simulator test run that reaches an overlay export test.Change
ExportEngine.simulatorOverlayError(hasOverlays:onIOSSimulator:): on the iOS Simulator (targetEnvironment(simulator) && os(iOS)), an export with overlays throwsKadrError.exportFailedbefore rendering, with a message pointing to the Known Platform Issues article. No new error case, so it stays source-compatible for a patch release.Video.export(to:)has anImportantcallout.SimulatorOverlayExportTests: 3 decision tests that run everywhere, plus a Simulator-only test that the export throws and writes no file..watermarkone) get.disabled(if: TestEnvironment.overlayExportsUnsupported, …), so they're skipped with a reason on the iOS Simulator.Why not a real workaround
A pass-through compositor writing into IOSurface-backed buffers does avoid the crash, but AVFoundation's built-in compositor can't be asked for such buffers. A workaround would mean re-implementing the built-in compositor's transforms, opacity ramps and transitions as a Simulator-only rendering path. Revisit if someone needs overlay exports on the Simulator (e.g. UI tests on CI), or drop this check once Apple fixes the runtime.
Results
swift test --no-parallel).xcodebuild docbuildsucceeds with no new warnings.