fix(ffmpeg): fix SIGSEGV on seek duration for invalid coded (#70)
* fix(ffmpeg): fix SIGSEGV on seek duration for invalid coded * test: update golden files
This commit is contained in:
parent
d824dba7d5
commit
c8024af62f
3 changed files with 5 additions and 0 deletions
|
|
@ -132,6 +132,9 @@ func (av *AVContext) SeekPosition(f float64) error {
|
||||||
|
|
||||||
// SeekDuration seeks to keyframe before the specified duration
|
// SeekDuration seeks to keyframe before the specified duration
|
||||||
func (av *AVContext) SeekDuration(ts time.Duration) error {
|
func (av *AVContext) SeekDuration(ts time.Duration) error {
|
||||||
|
if av.formatContext == nil || av.codecContext == nil {
|
||||||
|
return ErrDecoderNotFound
|
||||||
|
}
|
||||||
return seekDuration(av, ts)
|
return seekDuration(av, ts)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ func TestProcessor(t *testing.T) {
|
||||||
}, WithDebug(true), WithLogger(zap.NewExample()))
|
}, WithDebug(true), WithLogger(zap.NewExample()))
|
||||||
doGoldenTests(t, filepath.Join(testDataDir, "golden/result-fallback-image"), []test{
|
doGoldenTests(t, filepath.Join(testDataDir, "golden/result-fallback-image"), []test{
|
||||||
{name: "corrupted with fallback image", path: "fit-in/100x100/corrupt/everybody-betray-me.mkv", expectCode: 406},
|
{name: "corrupted with fallback image", path: "fit-in/100x100/corrupt/everybody-betray-me.mkv", expectCode: 406},
|
||||||
|
{name: "corrupted with fallback image", path: "filters:seek(0.1)/no_cover.mp3", expectCode: 406},
|
||||||
}, WithDebug(false), WithLogger(zap.NewExample()), WithFallbackImage("demo.png"))
|
}, WithDebug(false), WithLogger(zap.NewExample()), WithFallbackImage("demo.png"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
1
testdata/golden/result-fallback-image/filters%3Aseek%280.1%29/no_cover.mp3
vendored
Normal file
1
testdata/golden/result-fallback-image/filters%3Aseek%280.1%29/no_cover.mp3
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"message":"ffmpeg: decoder not found","status":406}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue