cmake: add ENABLE_VIDEOTOOLBOX=OFF option to fix Apple Silicon (M1/M2/M3) crash#1208
Open
TimeleftXL wants to merge 1 commit intoOpenKinect:masterfrom
Open
cmake: add ENABLE_VIDEOTOOLBOX=OFF option to fix Apple Silicon (M1/M2/M3) crash#1208TimeleftXL wants to merge 1 commit intoOpenKinect:masterfrom
TimeleftXL wants to merge 1 commit intoOpenKinect:masterfrom
Conversation
VTRgbPacketProcessor (VideoToolbox JPEG decoder) causes a heap corruption / abort on Apple Silicon (M1/M2/M3) due to incompatibilities between libfreenect2's threading model and the VideoToolbox API on arm64. Symptom: SIGABRT on a thread named "VideoToolbox" inside libfreenect2::VTRgbPacketProcessor::process() libfreenect2::AsyncPacketProcessor<RgbPacket>::execute() The pure-software TurboJPEG decoder (TurboJpegRgbPacketProcessor) is unaffected and produces identical output. Add an ENABLE_VIDEOTOOLBOX cmake option (default ON for backwards compatibility) so Apple Silicon users can opt out cleanly: cmake .. -DENABLE_VIDEOTOOLBOX=OFF This is the same class of issue as the OpenGLDepthPacketProcessor crash on M1, which is why CpuPacketPipeline alone does not prevent the crash — it only switches the depth decoder to CPU, leaving the RGB decoder on VideoToolbox. Tested on: Apple M1 (macOS 15), libfreenect2 0.2.0, Kinect v2 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
VTRgbPacketProcessor(VideoToolbox JPEG decoder) causes a hard crash on Apple Silicon (M1/M2/M3):Root cause: heap corruption / double-free in libfreenect2's threading model when VideoToolbox decodes JPEG frames on arm64. This is the same class of issue as the
OpenGLDepthPacketProcessorcrash on M1.CpuPacketPipelinealone does not fix this — it only switches the depth decoder to CPU, leaving RGB on VideoToolbox.Fix
Add an
ENABLE_VIDEOTOOLBOXcmake option (defaultONfor backwards compatibility). Apple Silicon users build with:This makes the library fall through to
TurboJpegRgbPacketProcessor, which is unaffected and produces identical output.Testing
Tested on Apple M1, macOS 15 (Sequoia), libfreenect2 0.2.0, Kinect v2 — stable with
ENABLE_VIDEOTOOLBOX=OFF. Crashes reproducibly without it.Notes
ONso existing Intel Mac / Linux builds are unaffectedVTRgbPacketProcessorcode itself is untouched; this just provides an escape hatchVTRgbPacketProcessorto use the modern VideoToolbox async API correctly, but that is a much larger change for unmaintained hardware