Fix speaker-track readiness race: skip mixed-file wait when tracks exist
This commit is contained in:
@@ -92,3 +92,25 @@ def test_meeting_sink_ignores_silence_only_and_unknown_users(tmp_path):
|
||||
assert manifest["tracks"] == []
|
||||
# Mixed archive still finalized and valid.
|
||||
assert _read_wav_frames(mixed) == SILENCE * 2
|
||||
|
||||
|
||||
def test_meeting_sink_ignores_writes_after_cleanup(tmp_path):
|
||||
"""Verify that writes after cleanup() are silently dropped."""
|
||||
mixed = tmp_path / "meeting.wav"
|
||||
tracks_dir = tmp_path / "tracks"
|
||||
sink = recording.MeetingSink(str(mixed), str(tracks_dir))
|
||||
|
||||
alice = FakeUser(111, display_name="Alice")
|
||||
sink.write(alice, FakeData(SPEECH))
|
||||
sink.cleanup()
|
||||
|
||||
# These writes should be dropped, not cause crashes or corrupt the files.
|
||||
sink.write(alice, FakeData(SPEECH))
|
||||
sink.write(None, FakeData(SILENCE))
|
||||
|
||||
# Mixed file should contain only the pre-cleanup frame.
|
||||
assert _read_wav_frames(mixed) == SPEECH
|
||||
assert _read_wav_frames(tracks_dir / "track-111.wav") == SPEECH
|
||||
# Manifest should still reference Alice.
|
||||
manifest = json.loads((tracks_dir / "tracks.json").read_text())
|
||||
assert len(manifest["tracks"]) == 1
|
||||
Reference in New Issue
Block a user