removed filelock field from Stream

This commit is contained in:
BroodjeAap 2020-08-18 18:25:26 +00:00
parent 8c29d47eeb
commit 0c7a34db51

View file

@ -10,7 +10,6 @@ import (
"net/http"
"os"
"path/filepath"
"sync"
"time"
"gocv.io/x/gocv"
@ -26,7 +25,6 @@ type Stream struct {
WatchAreas []WatchArea `json:"watchAreas"`
Timeouts float64 `json:"-"`
MotionDetected bool `json:"-"`
FileLock sync.Mutex `json:"-"`
}
// NewStream creates a new Stream Object
@ -149,7 +147,6 @@ func (s *Stream) GetWatchAreaByName(name string) (*WatchArea, bool) {
// SaveStreamInstant writes the img to the CurrentStreamInstantPath, moves existing instant to PreviousStreamInstantPath
func (s *Stream) SaveStreamInstant(mat gocv.Mat) {
s.FileLock.Lock()
streamStoreDir := s.GetStreamStoreDirPath()
os.MkdirAll(streamStoreDir, os.ModePerm)
@ -165,7 +162,6 @@ func (s *Stream) SaveStreamInstant(mat gocv.Mat) {
if swap {
s.SwapInstants(s.GetPreviousInstantPath(), s.GetCurrentInstantPath(), s.GetNextInstantPath())
}
s.FileLock.Unlock()
}
// SwapInstants swaps the file location, first current -> previous and then next -> current