Publish and subscribe over wss://livekit.uni-wh.de:7800 and refuse cleartext ws://. Conference room is uwh-telhai. Includes the uncommitted encoded H.264 publish path, Rally hairpin, and KMS wall overlay.
143 lines
4.9 KiB
Python
143 lines
4.9 KiB
Python
from config import Config, _parse_cameras, load_config
|
|
|
|
|
|
def test_parse_cameras_list():
|
|
assert _parse_cameras("1,5") == ["1", "5"]
|
|
assert _parse_cameras("all") == ["all"]
|
|
assert _parse_cameras("1-3") == ["1", "2", "3"]
|
|
|
|
|
|
def test_default_beamform_mode_auto():
|
|
assert Config().beamform_mode == "auto"
|
|
|
|
|
|
def test_torch_num_threads_default_one():
|
|
assert Config().torch_num_threads == 1
|
|
|
|
|
|
def test_enhance_infer_default_auto():
|
|
assert Config().enhance_infer == "auto"
|
|
|
|
|
|
def test_latency_flag_defaults():
|
|
c = Config()
|
|
assert c.audio_queue_ms is None
|
|
assert c.video_hold_s is None
|
|
assert c.worker_split_executor is False
|
|
assert c.enhance_speaker_only is False
|
|
assert c.audio_gate is False
|
|
assert c.audio_gate_open_db == -28.0
|
|
assert c.audio_gate_close_db == -34.0
|
|
assert c.audio_gate_hold_s == 0.3
|
|
assert c.display_video_capacity == 0
|
|
assert c.display_video_format == ""
|
|
assert c.display_gst_queue_buffers == 2
|
|
assert c.display_speaker_push == "timer"
|
|
assert c.participant_tags == ["uwh"]
|
|
assert c.display_hide_tags == []
|
|
assert c.display_hand_raise is True
|
|
assert c.display_hand_raise_hz == 4.0
|
|
assert c.display_hand_raise_hold_s == 1.0
|
|
assert c.display_hand_raise_model == "thunder"
|
|
assert c.display_speak_min_db == -40.0
|
|
assert c.display_speak_margin_db == 6.0
|
|
assert c.display_speak_hold_s == 0.6
|
|
assert c.display_speak_rise_db == 3.0
|
|
assert c.display_speak_corr == 0.4
|
|
assert c.display_speak_confirm == 2
|
|
assert c.portrait_blur is True
|
|
assert c.portrait_shm_dir == "/run/livekit-cameras/portrait"
|
|
assert c.portrait_hz == 8.0
|
|
assert c.portrait_blur_px == 7
|
|
assert c.portrait_hold_s == 0.8
|
|
|
|
|
|
def test_enhance_daemon_defaults():
|
|
c = Config()
|
|
assert c.enhance_daemon is True
|
|
assert c.enhance_socket == "/tmp/livekit-enhance.sock"
|
|
assert c.capture_daemon is True
|
|
assert c.capture_shm_dir == "/run/livekit-cameras/raw"
|
|
assert c.audio_daemon is True
|
|
assert c.audio_shm_dir == "/run/livekit-cameras/pcm"
|
|
assert c.single_publisher is True
|
|
|
|
|
|
def test_load_config_enhance_daemon_env(monkeypatch, tmp_path):
|
|
env = tmp_path / ".env"
|
|
env.write_text("")
|
|
monkeypatch.setenv("ENHANCE_DAEMON", "0")
|
|
monkeypatch.setenv("ENHANCE_SOCKET", "/run/foo.sock")
|
|
cfg = load_config(env)
|
|
assert cfg.enhance_daemon is False
|
|
assert cfg.enhance_socket == "/run/foo.sock"
|
|
|
|
|
|
def test_load_config_latency_env(monkeypatch, tmp_path):
|
|
env = tmp_path / ".env"
|
|
env.write_text("")
|
|
monkeypatch.setenv("AUDIO_QUEUE_MS", "60")
|
|
monkeypatch.setenv("VIDEO_HOLD_S", "0")
|
|
monkeypatch.setenv("WORKER_SPLIT_EXECUTOR", "1")
|
|
monkeypatch.setenv("ENHANCE_SPEAKER_ONLY", "true")
|
|
monkeypatch.setenv("AUDIO_GATE", "0")
|
|
monkeypatch.setenv("AUDIO_GATE_OPEN_DB", "-28")
|
|
monkeypatch.setenv("AUDIO_GATE_HOLD_S", "0.5")
|
|
monkeypatch.setenv("DISPLAY_VIDEO_CAPACITY", "1")
|
|
monkeypatch.setenv("DISPLAY_VIDEO_FORMAT", "BGRA")
|
|
monkeypatch.setenv("DISPLAY_GST_QUEUE_BUFFERS", "1")
|
|
monkeypatch.setenv("DISPLAY_SPEAKER_PUSH", "arrival")
|
|
cfg = load_config(env)
|
|
assert cfg.audio_queue_ms == 60
|
|
assert cfg.video_hold_s == 0.0
|
|
assert cfg.worker_split_executor is True
|
|
assert cfg.enhance_speaker_only is True
|
|
assert cfg.audio_gate is False
|
|
assert cfg.audio_gate_open_db == -28.0
|
|
assert cfg.audio_gate_hold_s == 0.5
|
|
assert cfg.display_video_capacity == 1
|
|
assert cfg.display_video_format == "bgra"
|
|
assert cfg.display_gst_queue_buffers == 1
|
|
assert cfg.display_speaker_push == "arrival"
|
|
|
|
|
|
def test_load_config_site_tags(monkeypatch, tmp_path):
|
|
env = tmp_path / ".env"
|
|
env.write_text("")
|
|
monkeypatch.setenv("PARTICIPANT_TAGS", "uwh")
|
|
monkeypatch.setenv("DISPLAY_HIDE_TAGS", "")
|
|
cfg = load_config(env)
|
|
assert cfg.participant_tags == ["uwh"]
|
|
assert cfg.display_hide_tags == []
|
|
monkeypatch.setenv("DISPLAY_HIDE_TAGS", "uwh")
|
|
cfg = load_config(env)
|
|
assert cfg.display_hide_tags == ["uwh"]
|
|
|
|
|
|
def test_load_config_hand_raise_env(monkeypatch, tmp_path):
|
|
env = tmp_path / ".env"
|
|
env.write_text("")
|
|
monkeypatch.setenv("DISPLAY_HAND_RAISE", "0")
|
|
monkeypatch.setenv("DISPLAY_HAND_RAISE_HZ", "3")
|
|
monkeypatch.setenv("DISPLAY_HAND_RAISE_HOLD_S", "1.2")
|
|
cfg = load_config(env)
|
|
assert cfg.display_hand_raise is False
|
|
assert cfg.display_hand_raise_hz == 3.0
|
|
assert cfg.display_hand_raise_hold_s == 1.2
|
|
|
|
|
|
def test_load_config_portrait_env(monkeypatch, tmp_path):
|
|
env = tmp_path / ".env"
|
|
env.write_text("")
|
|
monkeypatch.setenv("PORTRAIT_BLUR", "0")
|
|
monkeypatch.setenv("PORTRAIT_SHM_DIR", "/tmp/portrait")
|
|
monkeypatch.setenv("PORTRAIT_HZ", "5")
|
|
monkeypatch.setenv("PORTRAIT_BLUR_PX", "11")
|
|
monkeypatch.setenv("PORTRAIT_HOLD_S", "0.4")
|
|
cfg = load_config(env)
|
|
assert cfg.portrait_blur is False
|
|
assert cfg.portrait_shm_dir == "/tmp/portrait"
|
|
assert cfg.portrait_hz == 5.0
|
|
assert cfg.portrait_blur_px == 11
|
|
assert cfg.portrait_hold_s == 0.4
|