Files
livekit-cameras/tests/test_hop_shm.py
T
root 95bb7c50ee feat: point the fleet at wss LiveKit room uwh-telhai
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.
2026-10-11 00:48:50 +00:00

48 lines
1.3 KiB
Python

from hop_shm import HopReader, HopWriter, hop_bytes
def test_hop_ring_preserves_order(tmp_path):
path = str(tmp_path / "cam-01.pcm")
n = hop_bytes(16000, 2, 0.1)
w = HopWriter(path, n, nslots=4)
r = HopReader(path)
for i in range(3):
payload = bytes([i]) * n
w.write(payload)
got = [r.read() for _ in range(3)]
assert got[0] is not None and got[0][0] == 0
assert got[1] is not None and got[1][0] == 1
assert got[2] is not None and got[2][0] == 2
assert r.read() is None
w.close()
def test_hop_ring_skips_when_reader_lags(tmp_path):
path = str(tmp_path / "cam-01.pcm")
n = 32
w = HopWriter(path, n, nslots=4)
r = HopReader(path)
for i in range(10):
w.write(bytes([i]) * n)
last = r.read()
assert last is not None
w.close()
def test_reader_follows_writer_restart(tmp_path):
"""Cameras-only restart zeros seq; the wall must not stay stuck on _last."""
path = str(tmp_path / "cam-01.pcm")
n = 32
w = HopWriter(path, n, nslots=4)
r = HopReader(path)
for i in range(8):
w.write(bytes([i]) * n)
assert r.read() is not None
w.close()
w2 = HopWriter(path, n, nslots=4)
w2.write(bytes([99]) * n)
got = r.read()
assert got is not None and got[0] == 99
assert r.read() is None
w2.close()