ffmpeg: uncomment the NoKeyframe specific unit test (#277)

This commit is contained in:
JamesWanglf
2021-12-07 18:10:05 +02:00
committed by GitHub
parent 91b94f852f
commit 1b6c4df523
4 changed files with 44 additions and 49 deletions

BIN
data/kryp-1.ts Normal file

Binary file not shown.

BIN
data/kryp-2.ts Normal file

Binary file not shown.

View File

@@ -1322,6 +1322,46 @@ func TestTranscoderAPI_ClipInvalidConfig(t *testing.T) {
}
}
func noKeyframeSegment(t *testing.T, accel Acceleration) {
// Reproducing #219
run, dir := setupTest(t)
defer os.RemoveAll(dir)
cmd := `
cp "$1"/../data/kryp-*.ts .
# verify no keyframes in kryp-2.ts but there in kryp-1.ts
ffprobe -select_streams v -show_streams -show_packets kryp-1.ts | grep flags=K | wc -l | grep 1
ffprobe -select_streams v -show_streams -show_packets kryp-2.ts | grep flags=K | wc -l | grep 0
`
run(cmd)
prof := P144p30fps16x9
for i := 1; i <= 2; i++ {
tc := NewTranscoder()
in := &TranscodeOptionsIn{
Fname: fmt.Sprintf("%s/kryp-%d.ts", dir, i),
Accel: accel,
}
out := []TranscodeOptions{{
Oname: fmt.Sprintf("%s/out%d.ts", dir, i),
Profile: prof,
Accel: accel,
}}
_, err := tc.Transcode(in, out)
if i == 2 && (err == nil || err.Error() != "No keyframes in input") {
t.Error("Expected to fail for no keyframe segment but did not")
} else if i != 2 && err != nil {
t.Error(err)
}
tc.StopTranscoder()
}
}
func TestTranscoder_NoKeyframe(t *testing.T) {
noKeyframeSegment(t, Software)
}
/*
func detectionFreq(t *testing.T, accel Acceleration) {
run, dir := setupTest(t)
@@ -1377,46 +1417,3 @@ func TestTranscoder_DetectionFreq(t *testing.T) {
detectionFreq(t, Software)
}
*/
/*
func noKeyframeSegment(t *testing.T, accel Acceleration) {
// Reproducing #219
run, dir := setupTest(t)
defer os.RemoveAll(dir)
cmd := `
cp "$1"/../transcoder/kryp-*.ts .
# verify no keyframes in kryp-2.ts but there in kryp-1.ts
ffprobe -select_streams v -show_streams -show_packets kryp-1.ts | grep flags=K | wc -l | grep 1
ffprobe -select_streams v -show_streams -show_packets kryp-2.ts | grep flags=K | wc -l | grep 0
`
run(cmd)
tc := NewTranscoder()
prof := P144p30fps16x9
for i := 1; i <= 2; i++ {
in := &TranscodeOptionsIn{
Fname: fmt.Sprintf("%s/kryp-%d.ts", dir, i),
Accel: accel,
}
out := []TranscodeOptions{{
Oname: fmt.Sprintf("%s/out%d.ts", dir, i),
Profile: prof,
Accel: accel,
}}
_, err := tc.Transcode(in, out)
if i == 2 && (err == nil || err.Error() != "No keyframes in input") {
t.Error("Expected to fail for no keyframe segment but did not")
} else if i != 2 && err != nil {
t.Error(err)
}
}
tc.StopTranscoder()
}
func TestTranscoder_NoKeyframe(t *testing.T) {
noKeyframeSegment(t, Software)
}
*/

View File

@@ -792,16 +792,14 @@ func TestNvidia_OutputFPS(t *testing.T) {
outputFPS(t, Nvidia)
}
func TestNvidia_NoKeyframe(t *testing.T) {
noKeyframeSegment(t, Nvidia)
}
/*
func TestNvidia_DetectionFreq(t *testing.T) {
detectionFreq(t, Nvidia)
}
*/
/*
func TestNvidia_NoKeyframe(t *testing.T) {
noKeyframeSegment(t, Nvidia)
}
*/
// XXX test bframes or delayed frames