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.
|
// are written to the destination encoder, frames without are discarded.
|
||||||
func (d *Difference) Write(f []byte) (int, error) {
|
func (d *Difference) Write(f []byte) (int, error) {
|
||||||
if d.prev.Empty() {
|
if d.prev.Empty() {
|
||||||
d.prev, _ = gocv.IMDecode(f, gocv.IMReadColor)
|
var err error
|
||||||
return 0, nil
|
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()
|
defer img.Close()
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
|
||||||
imgDelta := gocv.NewMat()
|
imgDelta := gocv.NewMat()
|
||||||
defer imgDelta.Close()
|
defer imgDelta.Close()
|
||||||
|
|
Loading…
Reference in New Issue