improve ffmpeg manifest progress rendering

This commit is contained in:
2026-04-21 22:28:37 +02:00
parent 96348a6a34
commit beb6ce6cbb
2 changed files with 214 additions and 39 deletions

View File

@@ -231,3 +231,32 @@ func TestStreamManifestWithFFmpegFailureRemovesPartialFile(t *testing.T) {
t.Fatalf("expected no partial file after ffmpeg failure, stat err=%v", statErr)
}
}
func TestParseFFmpegDurationLine(t *testing.T) {
totalMS, ok := parseFFmpegDurationLine(" Duration: 00:04:52.57, start: 0.000000, bitrate: 975 kb/s")
if !ok {
t.Fatalf("expected duration parse to succeed")
}
if want := int64(292570); totalMS != want {
t.Fatalf("unexpected duration ms: got=%d want=%d", totalMS, want)
}
}
func TestParseFFmpegOutTime(t *testing.T) {
currentMS, ok := parseFFmpegOutTime("out_time=00:01:02.340000")
if !ok {
t.Fatalf("expected out_time parse to succeed")
}
if want := int64(62340); currentMS != want {
t.Fatalf("unexpected out_time ms: got=%d want=%d", currentMS, want)
}
}
func TestParseClockDurationMSInvalid(t *testing.T) {
if _, ok := parseClockDurationMS("bad"); ok {
t.Fatalf("expected invalid duration to fail")
}
if _, ok := parseClockDurationMS("00:12"); ok {
t.Fatalf("expected short duration to fail")
}
}