fix(stream): no copiar AAC multicanal en modo copy (WebKit lo rechaza igual)

El downmix estéreo del re-encode (f89396c) dejaba un agujero simétrico: una
fuente cuyo audio YA es AAC 5.1 se copiaba tal cual, y WebKit rechaza el
AAC multicanal en el primer segmento exactamente igual que el re-encodeado.
Copy de audio ahora solo cuando la pista es AAC con ≤2 canales; cualquier
otra cosa (no-AAC, AAC 5.1+, o canales desconocidos en el probe — fail-safe)
re-encodea a AAC estéreo 48k. La pista multicanal original queda intacta
para reproductor externo. Test smoke nuevo: fuente AAC 5.1 → re-encode.
This commit is contained in:
Deivid Soto 2026-06-11 00:05:50 +02:00
parent f89396ceed
commit a4a6e2f2d6
2 changed files with 29 additions and 8 deletions

View file

@ -205,6 +205,25 @@ func TestHLSCopy_Hevc10Eac3_IncidentShape(t *testing.T) {
}
}
func TestHLSCopy_Aac51MustReencode(t *testing.T) {
// AAC is NOT copy-safe when multichannel: WebKit rejects 6-channel AAC at
// the first media segment exactly like re-encoded 5.1. Source AAC 5.1 →
// must re-encode to stereo, never copy.
rt := copyTestRuntime(t)
src := genSource(t, rt, "aac51.mkv",
[]string{"-c:v", "libx264", "-preset", "ultrafast", "-pix_fmt", "yuv420p"},
[]string{"-c:a", "aac", "-ac", "6", "-b:a", "256k"}, 8)
s, pl := runCopySession(t, rt, src, 0)
assertCopyOutput(t, rt, s, pl, "h264", "aac", 8)
args := buildHLSCopyArgs(s.cfg, s.probe, s.tmpDir)
if containsSeq(args, "-c:a", "copy") {
t.Errorf("AAC 5.1 must NOT be copied (WebKit rejects multichannel AAC), args: %v", args)
}
if !containsSeq(args, "-ac", "2") {
t.Errorf("AAC 5.1 must re-encode to stereo, args: %v", args)
}
}
func TestHLSCopy_ResumeStartSec(t *testing.T) {
rt := copyTestRuntime(t)
src := genSource(t, rt, "resume.mkv",