Video: Replace OpenGL qml6glsink with appsink Metal path on macOS#14228
Open
DonLakeFlyer wants to merge 1 commit intomavlink:masterfrom
Open
Video: Replace OpenGL qml6glsink with appsink Metal path on macOS#14228DonLakeFlyer wants to merge 1 commit intomavlink:masterfrom
DonLakeFlyer wants to merge 1 commit intomavlink:masterfrom
Conversation
31b8018 to 2343504 Compare 2343504 to 0e37d62 Compare 0e37d62 to 702f155 Compare On macOS, the GStreamer qml6glsink element requires an OpenGL context, but Qt 6 defaults to Metal RHI. Rather than forcing OpenGL (deprecated on macOS), this adds a new appsink-based rendering path: GStreamer pipeline -> appsink -> GstAppSinkAdapter -> QVideoSink -> VideoOutput (Metal) Changes: - gstqgcvideosinkbin: Add macOS appsink path (videoconvert -> appsink) alongside existing D3D11 (Windows) and GL (Linux) paths - GstAppSinkAdapter: New class bridging GStreamer appsink to Qt QVideoSink, copies BGRA frames with stride-aware memcpy and buffer bounds validation - FlightDisplayViewMetal.qml: Qt VideoOutput component for Metal rendering - FlightDisplayViewVideo.qml: 3-way component selection (D3D11/Metal/GL) for both main and thermal video - QGCApplication: Let Qt use default Metal RHI on macOS instead of forcing OpenGL - VideoManager: Expose gstreamerAppleSink property, wire appsink adapter to QML VideoOutput's QVideoSink - GStreamer CMakeLists: Add GstApp dependency, Apple-gated sources and Qt Multimedia links - Unit test: _testAppsinkFrameDelivery validates end-to-end frame delivery through the appsink pipeline (macOS-only, QSKIP elsewhere) All changes are gated behind Q_OS_MACOS / if(APPLE) -- no impact on Windows, Linux, Android, or iOS builds.
702f155 to 1cc279e Compare Contributor
Build ResultsPlatform Status
All builds passed. Pre-commit
Pre-commit hooks: 4 passed, 33 failed, 7 skipped. Test Resultslinux-sanitizers: 67 passed, 0 skipped Artifact Sizes
|
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.
Summary
Replace the OpenGL-dependent qml6glsink GStreamer video rendering path on macOS with a new appsink -> QVideoSink -> VideoOutput path that uses Qt's native Metal RHI backend.
Motivation
On macOS, Qt 6 defaults to Metal for rendering. The existing GStreamer video path uses qml6glsink, which requires an OpenGL context. This forced QGC to override Qt's default and use the deprecated OpenGL API on macOS. This PR eliminates that dependency by extracting decoded frames via GStreamer's appsink and delivering them to Qt's QVideoSink, which renders natively through Metal.
Architecture
GStreamer pipeline -> appsink -> GstAppSinkAdapter -> QVideoSink -> VideoOutput (Metal)
The new path sits alongside the existing D3D11 (Windows) and GL (Linux) paths inside qgcvideosinkbin, selected at compile time via Q_OS_MACOS.
Changes
Unit Test: End-to-End Appsink Validation
This PR includes
_testAppsinkFrameDelivery, a new unit test that exercises the entire appsink rendering pipeline end-to-end on macOS (QSKIP on other platforms). The test builds a real GStreamer pipeline (videotestsrc -> videoconvert -> qgcvideosinkbin) with the appsink path active, wires aGstAppSinkAdapterto aQVideoSink, runs the pipeline to EOS, and verifies that:This validates that the entire new code path -- from GStreamer's appsink element through the adapter's BGRA frame copy to Qt's video sink -- functions correctly as a unit, catching regressions in the frame bridge that manual testing alone would miss.
Platform Safety
All changes are gated behind Q_OS_MACOS / if(APPLE). No impact on Windows, Linux, Android, or iOS builds.
Testing