fix: millisecond segment in the recording filename so two instances can't clobber a take
The dev multi-instance use case (one instance screen-capturing the other for
marketing/training videos) exposed a real bug. BuildStartPath in
MainViewModel.Recording.cs builds the start name with no dedup:
var name = RecordingFile.BuildStartName(DateTime.Now) + ".mp4";
var path = Path.Combine(folder, name);
Only FinalizeRecordingAsync calls UniquePath. So two instances that start
recording in the same minute computed the identical path
(ty-20260927-1454-0000.mp4) and both ffmpeg processes wrote one file -- a
corrupt take, not an error message.
Creator's fix (2026-09-27): add a millisecond count to the filename timestamp.
New format is ty-<yyyyMMdd>-<HHmm>-<fff>-<hh2mm2>.mp4. Both the start name and
the final name derive from _recordStartTime, so the ffff segment survives the
rename-on-stop and the final name cannot collide with another same-minute take
either. No UniquePath call needed, which keeps the start path a pure function of
the timestamp and the existing collision suffix behaviour intact.
Tests: 2 new (the same-minute guard and the rename-survival guard), 5 existing
assertions updated for the format. RecordingSaveDialogTests' stem fixtures
updated to match. 369/369 pass, 0 warnings.
Note: the first test run reported 367/367 because only ytLive.csproj had been
built -- the stale test DLL never picked up the new tests. The real count is 369.
This commit is contained in:
@@ -21,8 +21,8 @@ public sealed class RecordingSaveDialogTests : IDisposable
|
||||
private readonly string _dir = Path.Combine(
|
||||
Path.GetTempPath(), "ytLive-recsave-" + Guid.NewGuid().ToString("N")[..8]);
|
||||
|
||||
private const string AutoStem = "ty-20260926-1405-0130";
|
||||
private const string StartStem = "ty-20260926-1405-0000";
|
||||
private const string AutoStem = "ty-20260926-1405-000-0130";
|
||||
private const string StartStem = "ty-20260926-1405-000-0000";
|
||||
private const string Bytes = "fake-mp4-payload";
|
||||
|
||||
public RecordingSaveDialogTests() => Directory.CreateDirectory(_dir);
|
||||
|
||||
Reference in New Issue
Block a user