bug处理

This commit is contained in:
truewhile
2026-09-07 23:21:24 +08:00
parent c4b8114115
commit 5a47e6f52d
7 changed files with 108 additions and 21 deletions
+31 -1
View File
@@ -212,13 +212,43 @@ func TestBuildFFmpegArgsInputSeekBeforeDashI(t *testing.T) {
}
}
if idxSS < 0 || idxI < 0 || idxSS > idxI {
t.Fatalf("expected -ss before -i, args=%v", args)
t.Fatalf("expected local -ss before -i, args=%v", args)
}
if args[idxSS+1] != "125.500" {
t.Fatalf("start = %q", args[idxSS+1])
}
}
func TestBuildFFmpegArgsHTTPSeekAfterDashI(t *testing.T) {
cfg := &config.Config{}
cfg.Transcoder.MaxHeight = 720
cfg.Transcoder.SegmentSeconds = 4
cfg.Transcoder.Realtime = true
args := buildFFmpegArgsForInput(cfg, transcodeInput{
Source: "https://cdn.example.com/a.wmv",
StartSec: 90,
}, "/o/x.m3u8", "/o/seg_%05d.ts")
joined := " " + strings.Join(args, " ") + " "
if strings.Contains(joined, " -re ") {
t.Fatalf("seek restart must disable -re, got: %s", joined)
}
idxSS, idxI := -1, -1
for i, arg := range args {
if arg == "-ss" {
idxSS = i
}
if arg == "-i" && idxI < 0 {
idxI = i
}
}
if idxSS < 0 || idxI < 0 || idxSS < idxI {
t.Fatalf("expected http -ss after -i, args=%v", args)
}
if args[idxSS+1] != "90.000" {
t.Fatalf("start = %q", args[idxSS+1])
}
}
func TestSameHLSStart(t *testing.T) {
if !sameHLSStart(10, 10.2) {
t.Fatal("expected close starts to match")