From 4b4c90fb0cb7b76ec3e3437d8e60047ef73b74a6 Mon Sep 17 00:00:00 2001 From: Matteo Benedetto Date: Sun, 22 Mar 2026 16:30:57 +0100 Subject: [PATCH] deploy: add run.sh launch wrapper with GST_PLUGIN_PATH+LD_PRELOAD for R36S On linux-aarch64 the conda gst-libav package has an unfixable ABI mismatch (libdav1d.so.6 missing, libicuuc.so.78 via libxml2-16). Fix: use system gstreamer1.0-libav installed via apt with GST_PLUGIN_PATH, and preload system libgomp.so.1 to avoid static TLS block errors when dlopen loads libgstlibav.so. avdec_h264 and avdec_aac now register correctly on device. These vars are stored in conda activate.d/gst-env.sh and in deploy/run.sh. --- deploy/run.sh | 11 +++++++++++ docs/development-status.md | 13 ++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 deploy/run.sh diff --git a/deploy/run.sh b/deploy/run.sh new file mode 100644 index 0000000..2a5bd49 --- /dev/null +++ b/deploy/run.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +# Launch wrapper for r36s-dlna-browser on ArkOS / R36S +# Requires: conda env r36s-dlna-browser, system gstreamer1.0-libav installed via apt. +# +# System plugin path makes avdec_h264/aac available (conda gst-libav has broken deps on aarch64). +# LD_PRELOAD is required to work around "cannot allocate memory in static TLS block" for libgomp. +export GST_PLUGIN_PATH=/usr/lib/aarch64-linux-gnu/gstreamer-1.0 +export LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libgomp.so.1 + +CONDA_ENV=/home/ark/miniconda3/envs/r36s-dlna-browser +exec "$CONDA_ENV/bin/python" -m r36s_dlna_browser "$@" diff --git a/docs/development-status.md b/docs/development-status.md index c0250ff..ff61d74 100644 --- a/docs/development-status.md +++ b/docs/development-status.md @@ -67,14 +67,17 @@ Milestone 3 — SDL Video Viewport, HUD, and Wayland Compatibility - GStreamer imports now succeed in the dedicated env (`GLib`, `GObject`, `Gst`, `GstApp`, `GstVideo`), and `Application` imports cleanly. - ArkOS menu launch works on the physical device, and DLNA browsing reaches real MiniDLNA content. - Real playback is currently blocked by missing decoder elements in the device env: direct probing of a MiniDLNA `.mkv` URL showed missing H.264 High Profile and MPEG-4 AAC decoders, while the user-facing "can't play a text file" message is a misleading fallback caused by an additional text stream in the container. -- Direct package installs on the physical R36S now added `gst-libav`, `gst-plugins-bad`, `ffmpeg`, `libxml2-16`, and several related runtime libraries into `/home/ark/miniconda3/envs/r36s-dlna-browser`; `h264parse` now registers, but `gst-libav` still does not expose `avdec_h264` because `libgstlibav.so` remains blocked by unresolved `dav1d` and `icu` ABI/runtime mismatches on `linux-aarch64`. -- Some optional GStreamer plugins still warn about additional codec libraries (`libxml2`, `libFLAC`, `libvpx`, `mpg123`) that are not yet installed in the env. +- **RESOLVED**: `gst-libav` conda package on `linux-aarch64` has an unfixable ABI mismatch: `libavcodec.so` links `libdav1d.so.6` (from dav1d <1.3) but only dav1d 1.4.x (`.so.7`) is available, and via `libxml2-16` it also pulls `libicuuc.so.78` which is not packaged for linux-aarch64 on conda-forge. **Solution**: install system `gstreamer1.0-libav` (v1.16.1) via apt and use `GST_PLUGIN_PATH` + `LD_PRELOAD` to expose its plugins to the conda Python runtime. +- On the physical R36S, `avdec_h264` and `avdec_aac` now register and resolve when launched with: + `LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libgomp.so.1 GST_PLUGIN_PATH=/usr/lib/aarch64-linux-gnu/gstreamer-1.0` + The `LD_PRELOAD` is required to avoid "cannot allocate memory in static TLS block" from the conda `libgomp.so` being loaded late by dlopen. +- These variables are now persisted in `/home/ark/miniconda3/envs/r36s-dlna-browser/etc/conda/activate.d/gst-env.sh` and explicitly set in `deploy/run.sh`. ## Next Recommended Actions 1. Run a visual playback smoke test and confirm SDL-rendered video plus HUD eliminates flashing on host playback. 2. Validate the SDL-texture playback path on the target R36S `kmsdrm` backend. 3. Measure CPU/load on RK3326 hardware during audio and video playback. -4. If RGBA upload cost is too high, add a follow-up YUV texture upload path using `SDL_UpdateYUVTexture`. -5. Install matching `gst-libav` and `gst-plugins-bad` packages into `/home/ark/miniconda3/envs/r36s-dlna-browser`, then confirm `avdec_h264`, an AAC decoder, and `h264parse` appear in `gst-inspect-1.0`. -6. Resolve the remaining `gst-libav` runtime chain on `linux-aarch64` by finding a compatible `ffmpeg`/`dav1d`/`icu` combination or by supplying the missing shared libraries manually, then re-test the real MiniDLNA `.mkv` URL with `gst-launch-1.0` and from ArkOS `Ports -> MatHacks`. \ No newline at end of file +4. Test real MiniDLNA `.mkv` H.264/AAC media end-to-end from the ArkOS `Ports -> MatHacks` launcher using `deploy/run.sh`. +5. If RGBA upload cost is too high, add a follow-up YUV texture upload path using `SDL_UpdateYUVTexture`. +6. `avdec_hevc` is still missing (HEVC decoders not in system apt `gstreamer1.0-libav 1.16.1`); AV1 excluded intentionally as too heavy for RK3326 — this is acceptable for the H.264/AAC primary codec target. \ No newline at end of file