mirror of
https://github.com/livepeer/lpms
synced 2025-09-26 19:51:36 +08:00
ffmpeg: uncomment the NoKeyframe specific unit test (#277)
This commit is contained in:
BIN
data/kryp-1.ts
Normal file
BIN
data/kryp-1.ts
Normal file
Binary file not shown.
BIN
data/kryp-2.ts
Normal file
BIN
data/kryp-2.ts
Normal file
Binary file not shown.
@@ -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)
|
||||
}
|
||||
*/
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user