MIDI drops show in about 1-2 s

- NA Tracks and the ProPresenter Mac: one long-lived ssh each streams the
  MIDI sessions (checked twice a second, sent on change) instead of an ssh
  login every 5 s; a silent stream gives no verdict after 12 s.
- NA Ingest's own session is read twice a second (was every 2 s).
- MIDI links show a drop after 1 s (was 3 s); everything redraws twice a
  second (was once).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-11 07:55:39 -04:00
co-authored by Claude Opus 5.5
parent 7d5233a1d7
commit 3649fb269f
2 changed files with 84 additions and 7 deletions
+24 -3
View File
@@ -329,6 +329,27 @@ class TestChecks(unittest.TestCase):
self.assertIsNone(sp.parse_remote_midi("ssh: connect to host timed out"))
self.assertEqual(sp.remote_midi_hosts(CONFIG), ["prop", "tracks"])
def test_a_midi_drop_shows_within_a_second_or_two(self):
engine = sp.Engine(CONFIG)
run_steps(engine, self.snap, self.now, 2)
self.snap.midi["NA Ingest"]["peers"] = [p for p in self.snap.midi["NA Ingest"]["peers"] if p["name"] != "Lighting PC"]
tiles, _ = run_steps(engine, self.snap, self.now + 3, 1.0, step=0.5)
self.assertEqual(tiles["midi"]["x"], "MIDI\nLIGHT PC MIDI LOST") # 1 s, not 3
def test_remote_midi_stream_script_runs_and_streams(self):
p = subprocess.Popen(["/usr/bin/python3", "-u", "-"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
p.stdin.write(sp.remote_midi_stream_script(0.1))
p.stdin.close()
first = p.stdout.readline()
p.kill()
self.assertIsInstance(sp.parse_remote_midi(first), dict)
def test_a_silent_remote_stream_gives_no_verdict(self):
self.snap.remote_midi["tracks"] = {"NA Tracks": {"port": 5004, "peers": []}}
self.snap.remote_midi_time["tracks"] = self.now - 30
self.assertEqual(sp.check_midi_peer({"type": "midi_peer", "host": "tracks", "session": "NA Tracks",
"peer": "Lighting PC"}, self.snap, self.ctx)[0][1].level, sp.OK)
def test_midi_peer_joining_is_not_an_error(self):
for p in self.snap.midi["NA Ingest"]["peers"]:
p["state"] = "connected" # joined, clock sync not finished yet
@@ -1480,13 +1501,13 @@ class TestAgainstFakeCompanion(unittest.TestCase):
store["custom"]["sp_cmd"] = ";ack atem"
data_dir = tempfile.mkdtemp()
originals = (sp.poll_mdns, sp.poll_system, sp.poll_midi, sp.poll_remote, sp.poll_dante_map,
sp.poll_remote_midi)
sp.start_remote_midi_streams)
sp.poll_dante_map = lambda *a, **k: None # never log in to a switch from a test
sp.poll_mdns = lambda snap, seconds=3: None
sp.poll_system = lambda snap, cfg: None
sp.poll_midi = lambda snap, cfg: None # CoreMIDI has its own test
sp.poll_remote = lambda snap, cfg: None # never SSH anywhere from a test
sp.poll_remote_midi = lambda snap, cfg: None
sp.start_remote_midi_streams = lambda snap, cfg, stop: []
stop = threading.Event()
loop = threading.Thread(target=sp.run, args=(cfg, data_dir), kwargs={"stop": stop}, daemon=True)
try:
@@ -1503,7 +1524,7 @@ class TestAgainstFakeCompanion(unittest.TestCase):
stop.set()
loop.join(timeout=15)
(sp.poll_mdns, sp.poll_system, sp.poll_midi, sp.poll_remote, sp.poll_dante_map,
sp.poll_remote_midi) = originals
sp.start_remote_midi_streams) = originals
store["conns"]["ATEM"]["category"] = "good"
self.assertFalse(loop.is_alive()) # it shuts down cleanly
self.assertTrue(store["custom"]["sp_hb"].isdigit())