Skip to content

fix(viewer): run PulseAudio so Qt 6 video plays with audio#3001

Merged
vpetersson merged 1 commit into
masterfrom
fix-qt6-video-audio
Jun 6, 2026
Merged

fix(viewer): run PulseAudio so Qt 6 video plays with audio#3001
vpetersson merged 1 commit into
masterfrom
fix-qt6-video-audio

Conversation

@vpetersson

Copy link
Copy Markdown
Contributor

Issues Fixed

Fixes #3000

Description

Debian's Qt 6 Multimedia is compiled with PulseAudio as its only audio backendlibQt6Multimedia.so.6 links libpulse and contains no ALSA code. The viewer container runs no sound server, so QMediaDevices enumerates zero audio outputs, QAudioOutput keeps a null device, and every video on a Qt 6 board (pi4-64, pi5, x86, arm64) plays silent. The pre-#2905 mpv path talked ALSA directly and needed no sound server, which is why audio regressed with the QtMultimedia migration.

  • Ship pulseaudio (+ pulseaudio-utils for field debugging via pactl) in the Qt 6 viewer images.
  • start_viewer.sh starts a minimal per-container daemon as the viewer user. The config is generated (the stock default.pa detects cards via module-udev-detect, which finds nothing in a container without udevd): one module-alsa-card per /proc/asound/cards entry, loaded with name=<alsa card id>, so pulse sink names embed the ALSA card name (alsa_output.vc4hdmi0.hdmi-stereo). That's exactly the CARD=<name> discriminator VideoView::resolveAlsaDevice matches against, so the existing HDMI-port auto-detection and the hdmi/local audio_output setting keep working unchanged.
  • Qt 5 boards (pi2/pi3) are untouched — GstFbdevMediaPlayer drives alsasink directly and their images don't ship pulseaudio.

Validated on a physical Pi 4 running the pi4-64 image built from this branch: the stats log INIT line reports audio_default=vc4-hdmi-0 Digital Stereo (HDMI) (previously empty), the vc4hdmi0 PCM reaches RUNNING with 48 kHz IEC958 samples flowing during video playback, the AnthiasViewer stream attaches to alsa_output.vc4hdmi0.hdmi-stereo, and module-suspend-on-idle releases the PCM between clips.

Checklist

  • I have performed a self-review of my own code.
  • New and existing unit tests pass locally and on CI with my changes.
  • I have done an end-to-end test for Raspberry Pi devices.
  • I have tested my changes for x86 devices.
  • I added a documentation for the changes I have made (when necessary).

🤖 Generated with Claude Code

Debian's Qt 6 Multimedia is compiled with PulseAudio as its only
audio backend (libQt6Multimedia.so.6 links libpulse and contains no
ALSA code), so without a running PulseAudio server QMediaDevices
enumerates zero audio outputs, QAudioOutput keeps a null device, and
every video on a Qt 6 board (pi4-64, pi5, x86, arm64) plays silent.
The pre-QtMultimedia mpv path talked ALSA directly and needed no
sound server, which is why audio regressed with the migration.

- ship pulseaudio (+ pulseaudio-utils for field debugging) in the
  Qt 6 viewer images
- start a minimal per-container daemon as the viewer user from
  start_viewer.sh; the generated config loads one module-alsa-card
  per /proc/asound/cards entry with name=<alsa card id>, so the
  pulse sink names embed the ALSA card name and the existing
  CARD=<name> matching in VideoView::resolveAlsaDevice (HDMI-port
  auto-detection, hdmi/local audio_output setting) keeps working
  unchanged on top of pulse
- module-udev-detect finds nothing in a container without udevd,
  which is why the stock default.pa is not used
- update the arm64 audio log message: the 'default' device now
  resolves to the PulseAudio default sink, not ALSA's ~/.asoundrc

Validated on a physical Pi 4 (pi4-64 image): vc4hdmi0 PCM reaches
RUNNING with 48 kHz IEC958 samples flowing during video playback,
and the AnthiasViewer stream attaches to
alsa_output.vc4hdmi0.hdmi-stereo.

Fixes #3000

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vpetersson vpetersson requested a review from a team as a code owner June 6, 2026 19:12
@vpetersson vpetersson self-assigned this Jun 6, 2026
@vpetersson vpetersson requested a review from Copilot June 6, 2026 19:12
@sonarqubecloud

sonarqubecloud Bot commented Jun 6, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes silent audio on Qt 6 viewer images by ensuring a PulseAudio server is available inside the viewer container (required because Debian’s Qt 6 Multimedia build uses PulseAudio as its only audio backend).

Changes:

  • Install pulseaudio (+ pulseaudio-utils for pactl debugging) in Qt 6 viewer images.
  • Start a minimal per-container PulseAudio daemon as the viewer user with a generated config that loads ALSA cards from /proc/asound/cards.
  • Update arm64 viewer logging/comments to reflect that the “default” audio device resolves via PulseAudio on Qt 6 boards.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
tools/image_builder/utils.py Adds PulseAudio packages to Qt 6 viewer image dependencies.
src/anthias_viewer/media_player.py Updates arm64 audio-device logging/comments to match PulseAudio-backed behavior.
bin/start_viewer.sh Starts a minimal PulseAudio daemon (generated config, ALSA card modules) before launching the viewer.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vpetersson vpetersson merged commit 66ed89c into master Jun 6, 2026
10 checks passed
vpetersson added a commit that referenced this pull request Jun 7, 2026
- CalVer (YYYY.0M.MICRO); still June 2026, micro 1 -> 2
- Ships the Qt 6 video audio fix (#3001) — PulseAudio in the viewer
  container; videos were silent on pi4-64/pi5/x86/arm64 since the
  QtMultimedia migration
- Adds the arm64/Qt6 pi3-64 board and the Rock Pi 4 fleet (#2985)
- Page-load watchdog so a stalled fetch can't freeze the display
  (#3003), Sentry error tracking for the Django services (#3007)
- Redis data persisted to the mounted volume so device identity
  survives recreation (#2983); unpinner also rolls OS + supervisor
  updates (#2984)
- Streamed backup downloads (#3005), 12-hour AM/PM asset times
  (#3002), BuildKit frontend via mirror.gcr.io (#3008)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Audio issue when playing videos on standalone balena installation on version v2026.6.1 installed from 2026-06-02-anthias-pi4-64.img

2 participants