test(audio): ffprobe/ffmpeg must cap streams, ffprobe must narrow its output (#49), red
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -109,3 +109,20 @@ printf data > "$last"`)
|
||||
require.NoError(t, err)
|
||||
assert.NotContains(t, " "+strings.ReplaceAll(string(raw), "\n", " ")+" ", " -t ")
|
||||
}
|
||||
|
||||
func TestFFmpegToWAV_CapsTheStreamCountBeforeTheInput(t *testing.T) {
|
||||
// ffmpeg also allocated ~570 MB opening the 900-stream file (#49).
|
||||
rec := filepath.Join(t.TempDir(), "argv")
|
||||
bin := stub(t, `printf '%s\n' "$@" > `+rec+`
|
||||
for a; do last="$a"; done
|
||||
printf data > "$last"`)
|
||||
|
||||
err := (&audio.FFmpeg{Bin: bin}).ToWAV(context.Background(), "/spool/in", filepath.Join(t.TempDir(), "o.wav"))
|
||||
|
||||
require.NoError(t, err)
|
||||
args := argvOf(t, rec)
|
||||
ms, in := indexOf(args, "-max_streams"), indexOf(args, "-i")
|
||||
require.GreaterOrEqual(t, ms, 0, "argv: %v", args)
|
||||
assert.Equal(t, "32", args[ms+1])
|
||||
assert.Less(t, ms, in, "an input option placed after -i is applied to the output")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user