mirror of https://bitbucket.org/ausocean/av.git
filter: check for errors after decoding
This commit is contained in:
parent
e0fa474906
commit
b15b649151
|
@ -74,12 +74,16 @@ func (d *Difference) Close() error {
|
|||
// are written to the destination encoder, frames without are discarded.
|
||||
func (d *Difference) Write(f []byte) (int, error) {
|
||||
if d.prev.Empty() {
|
||||
d.prev, _ = gocv.IMDecode(f, gocv.IMReadColor)
|
||||
return 0, nil
|
||||
var err error
|
||||
d.prev, err = gocv.IMDecode(f, gocv.IMReadColor)
|
||||
return 0, err
|
||||
}
|
||||
|
||||
img, _ := gocv.IMDecode(f, gocv.IMReadColor)
|
||||
img, err := gocv.IMDecode(f, gocv.IMReadColor)
|
||||
defer img.Close()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
imgDelta := gocv.NewMat()
|
||||
defer imgDelta.Close()
|
||||
|
|
Loading…
Reference in New Issue