diff --git a/cgo/ffmpeg/audio.go b/cgo/ffmpeg/audio.go index 76fd9ae..fef83c6 100644 --- a/cgo/ffmpeg/audio.go +++ b/cgo/ffmpeg/audio.go @@ -585,6 +585,11 @@ func (self *AudioDecoder) Decode(pkt []byte) (gotframe bool, frame av.AudioFrame cgotframe := C.int(0) + if ff.codecCtx == nil { + err = fmt.Errorf("ffmpeg: Decode ff.codecCtx NULL") + return + } + cerr := C.decode(ff.codecCtx, ff.frame, (*C.uchar)(unsafe.Pointer(&pkt[0])), C.int(len(pkt)), &cgotframe) if cerr < C.int(0) {