mirror of https://bitbucket.org/ausocean/av.git
change to error handling
This commit is contained in:
parent
fd8e2e2426
commit
2e70e3fa1b
|
@ -87,7 +87,7 @@ func (m *MOGFilter) Write(f []byte) (int, error) {
|
|||
m.hfCount = 0
|
||||
img, err := gocv.IMDecode(f, gocv.IMReadColor)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("image can't be decoded: %w", err)
|
||||
return len(f), fmt.Errorf("image can't be decoded: %w", err)
|
||||
}
|
||||
defer img.Close()
|
||||
|
||||
|
@ -135,7 +135,7 @@ func (m *MOGFilter) Write(f []byte) (int, error) {
|
|||
|
||||
// Don't write to destination if there is no motion.
|
||||
if len(contours) == 0 {
|
||||
return 0, nil
|
||||
return len(f), nil
|
||||
}
|
||||
|
||||
// Write to destination, past 4 frames then current frame.
|
||||
|
@ -143,7 +143,7 @@ func (m *MOGFilter) Write(f []byte) (int, error) {
|
|||
_, err := m.dst.Write(h)
|
||||
m.hold[i] = nil
|
||||
if err != nil {
|
||||
return 0, err
|
||||
return len(f), fmt.Errorf("could not write previous frames: %w", err)
|
||||
}
|
||||
}
|
||||
return m.dst.Write(f)
|
||||
|
|
Loading…
Reference in New Issue