feat: known-good CPU audio + 1080p VAAPI + KMS display wall

Working snapshot before the OpenVINO MetricGAN GPU spike:
thread-capped SpeechBrain DelaySum+MetricGAN on CPU, hop 200 ms,
video hold for A/V sync, Arc VAAPI H.264, headless kmssink wall.
32 tests passing. Do not treat this as a GPU audio path.
This commit is contained in:
root
2026-08-28 07:14:21 +00:00
parent 11776adf52
commit 736eccb932
17 changed files with 1421 additions and 46 deletions
+23
View File
@@ -0,0 +1,23 @@
"""A/V hold queue: video is delayed to match the audio hop."""
from collections import deque
from run_worker import drain_held_frames
def test_drain_nothing_until_hold():
q = deque([(0.0, b"a"), (0.05, b"b")])
assert list(drain_held_frames(q, now=0.1, hold_s=0.2)) == []
assert len(q) == 2
def test_drain_ready_frames():
q = deque([(0.0, b"a"), (0.05, b"b"), (0.25, b"c")])
got = list(drain_held_frames(q, now=0.26, hold_s=0.2))
assert got == [b"a", b"b"]
assert list(q) == [(0.25, b"c")]
def test_no_hold_drains_all():
q = deque([(1.0, b"x")])
assert list(drain_held_frames(q, now=1.0, hold_s=0.0)) == [b"x"]
assert not q
+81
View File
@@ -0,0 +1,81 @@
"""5x4 camera mosaic helpers."""
import numpy as np
from display_grid import (
CameraGrid,
camera_ids,
display_name,
is_camera_identity,
letterbox_bgra,
placeholder,
)
def test_camera_ids():
ids = camera_ids(20)
assert ids[0] == "cam-01" and ids[-1] == "cam-20"
assert len(ids) == 20
def test_is_camera_identity():
assert is_camera_identity("cam-07")
assert is_camera_identity("cam-07", "cam")
assert not is_camera_identity("speaker")
assert not is_camera_identity("display-wall")
def test_display_name():
assert display_name("cam-07") == "CAM-07"
assert display_name("cam-01") == "CAM-01"
def test_letterbox_preserves_canvas_size():
src = np.zeros((720, 1280, 4), dtype=np.uint8)
src[:] = (0, 0, 255, 255)
out = letterbox_bgra(src, 384, 270)
assert out.shape == (270, 384, 4)
assert out.dtype == np.uint8
def test_grid_render_size_and_slots():
g = CameraGrid(width=1920, height=1080, cols=5, rows=4)
assert g.tile_w == (1920 - g.gap * 6) // 5
assert g.tile_h == (1080 - g.gap * 5) // 4
assert g.inner_w < g.tile_w
assert g.inner_h < g.tile_h
assert len(g.identities) == 20
buf = g.render()
assert len(buf) == 1920 * 1080 * 4
frame = np.zeros((720, 1280, 4), dtype=np.uint8)
frame[:] = (255, 0, 0, 255)
g.set_frame("cam-07", frame)
buf2 = g.render()
assert buf2 != buf
g.clear("cam-07")
assert len(g.render()) == len(buf)
def test_empty_tiles_have_name_placeholder():
g = CameraGrid(width=1920, height=1080, cols=5, rows=4)
# Name is drawn in the inner region — not a flat fill.
tile = g._tiles["cam-01"]
assert tile.shape == (g.tile_h, g.tile_w, 4)
assert tile.sum() > 0
inner = tile[g.border : g.border + g.inner_h, g.border : g.border + g.inner_w]
# Center of an empty tile is not uniform (text glyphs).
assert inner.std() > 1.0
def test_gap_separates_tiles():
g = CameraGrid(width=1920, height=1080, cols=5, rows=4, gap=8)
canvas = np.frombuffer(g.render(), dtype=np.uint8).reshape(1080, 1920, 4)
# Pixel in the gutter between col 0 and col 1 is canvas background, not a tile.
x = g.gap + g.tile_w + g.gap // 2
y = g.gap + 4
assert tuple(canvas[y, x]) == (10, 10, 10, 255)
def test_placeholder_draws_text():
img = placeholder(640, 360, ["Screen share", "stub"])
assert img.shape == (360, 640, 4)
assert img.sum() > 0
+21
View File
@@ -0,0 +1,21 @@
"""DRM connector discovery for the 3-display LiveKit wall."""
from drm_outputs import list_outputs, select_outputs
def test_lists_arc_hdmi():
outs = list_outputs()
assert outs, "expected at least one DRM connector"
names = {o.name for o in outs}
assert "HDMI-A-7" in names
hdmi7 = next(o for o in outs if o.name == "HDMI-A-7")
assert hdmi7.connector_id > 0
assert hdmi7.driver in ("xe", "i915")
assert hdmi7.node.startswith("/dev/dri/card")
def test_select_three_prefers_xe_hdmi():
three = select_outputs(n=3)
assert len(three) == 3
assert three[0].name == "HDMI-A-7" or three[0].connected
ids = [o.connector_id for o in three]
assert len(set(ids)) == 3
+1 -1
View File
@@ -7,4 +7,4 @@ def test_alsa_ffmpeg_uses_low_delay_flags():
src = inspect.getsource(run_worker)
assert '"-fflags", "nobuffer"' in src
assert '"-flags", "low_delay"' in src
assert '"-thread_queue_size", "64"' in src
assert '"-thread_queue_size"' in src