Skip to content

fix(viewer): default x86 audio fallback to ALSA 'default'#2927

Open
Xzzz wants to merge 1 commit into
Screenly:masterfrom
Xzzz:fix/x86-audio-default-fallback
Open

fix(viewer): default x86 audio fallback to ALSA 'default'#2927
Xzzz wants to merge 1 commit into
Screenly:masterfrom
Xzzz:fix/x86-audio-default-fallback

Conversation

@Xzzz
Copy link
Copy Markdown

@Xzzz Xzzz commented May 20, 2026

On x86, get_alsa_audio_device() returns sysdefault:CARD=HID as the fallback, which matches no real ALSA card on Intel/AMD/Nvidia HDA chipsets. This bypasses the container's ~/.asoundrc bind mount and leaves operators with no way to route audio.

The ARM64 branch a few lines above already returns 'default' for the same reason — heterogeneous SoCs, no portable card name — and lets operators override via ~/.asoundrc. This PR mirrors that approach for x86.

Reproduction

  • x86 host (Intel HDA PCH card with HDMI output to a TV)
  • Debian minimal install, Anthias v2026.05.0+
  • mpv launched by the viewer logs --audio-device=alsa/sysdefault:CARD=HID → no audio
  • /proc/asound/cards shows only card 0 (HDA Intel PCH); no HID card exists

Verification

After this patch, ~/.asoundrc (e.g. routing default to hw:0,3 for the HDMI sink) is honored, and audio plays correctly on the TV.

…oundrc)

On x86, get_alsa_audio_device() previously returned
'sysdefault:CARD=HID' as the fallback, which corresponds to no
real ALSA card on standard Intel/AMD/Nvidia HDA chipsets. The
container's ~/.asoundrc bind mount was therefore bypassed, leaving
operators unable to redirect audio output.

The ARM64 branch a few lines above already returns 'default' for
the same reason (heterogeneous SoCs, no portable card name), and
relies on ~/.asoundrc for operator overrides. Apply the same
approach to x86.
@Xzzz Xzzz requested a review from a team as a code owner May 20, 2026 10:13
@sonarqubecloud
Copy link
Copy Markdown

@vpetersson
Copy link
Copy Markdown
Contributor

Validated against an x86 testbed (Intel HDA PCH + a USB Audio+HID dongle) — change is structurally correct, but the PR ships a failing unit test.

Validation

  • /proc/asound/cards on the testbed shows card 0 = HDA Intel PCH, card 1 = HID (CSCTEK USB Audio+HID dongle). Minor nit on the PR body: a HID card does exist on this box — it's just a USB peripheral, not the HDMI sink. Softening the wording to "no portable card name across Intel/AMD/Nvidia HDA chipsets" (matching the ARM64 comment this mirrors) would be more accurate; the symptom you describe (audio routed away from HDMI) still applies.
  • C++ side handles default cleanly: src/anthias_webview/src/videoview.cpp:380 short-circuits when the extracted card name is literally default and uses QMediaDevices::defaultAudioOutput(). No D-Bus / CARD= parsing regression from dropping the CARD= token.
  • ~/.asoundrc bind mount is in place (docker-compose.yml.tmpl:82), so the override hook the PR relies on really exists.

Blocker — CI will fail

tests/test_media_player.py:341 still asserts the old value:

def test_hdmi_on_x86_falls_back_to_hid(alsa_settings: Any) -> None:
    ...
    assert get_alsa_audio_device() == 'sysdefault:CARD=HID'

Running it against this branch:

AssertionError: assert 'default' == 'sysdefault:CARD=HID'

Please rename to test_hdmi_on_x86_falls_back_to_default and assert 'default'. (The status rollup only shows SonarCloud right now — the pytest job will catch this once it runs.)

Nice-to-have (non-blocking)

The ARM64 branch logs the chosen ALSA card once per process via _log_arm64_alsa_default_once() so silent-HDMI reports carry breadcrumbs. The x86 path now has the same "debug via .asoundrc" failure mode — symmetric once-per-process logging here would help future operators. Fine to defer to a follow-up.

Risk

Low. For devices without an .asoundrc, behavior changes from "fall back to a CARD=HID device that probably isn't the intended sink" to "fall back to Qt's platform default" — strictly better, and overridable as documented.

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.

2 participants