diff --git a/codec/mjpeg/lex.go b/codec/mjpeg/lex.go index 1ab6db14..46ab4ce8 100644 --- a/codec/mjpeg/lex.go +++ b/codec/mjpeg/lex.go @@ -38,8 +38,6 @@ import ( ) var noDelay = make(chan time.Time) -var frameGet int = 0 -var frameSend int = 0 func init() { close(noDelay) @@ -64,7 +62,6 @@ func Lex(dst io.Writer, src io.Reader, delay time.Duration) error { if n < 2 { return nil } - frameGet++ if err != nil { if err == io.EOF { return nil @@ -91,8 +88,6 @@ func Lex(dst io.Writer, src io.Reader, delay time.Duration) error { } <-tick _, err = dst.Write(buf) - frameSend++ - fmt.Printf("frames into lex: %v frames getting written: %v\t|\t", frameGet, frameSend) if err != nil { return err } diff --git a/filter/filter.go b/filter/filter.go index c6fec897..ec182531 100644 --- a/filter/filter.go +++ b/filter/filter.go @@ -27,9 +27,7 @@ LICENSE package filter import ( - "fmt" "io" - "time" ) // Interface for all filters. @@ -46,16 +44,6 @@ type NoOp struct { func NewNoOp(dst io.Writer) *NoOp { return &NoOp{dst: dst} } -func (n *NoOp) Write(p []byte) (int, error) { - if frames == 0 { - t1 = time.Now() - } - frames++ - if frames >= 24 { - fmt.Printf("25 frames takes: %dms\n\n", time.Now().Sub(t1).Milliseconds()) - frames = 0 - } - return n.dst.Write(p) -} +func (n *NoOp) Write(p []byte) (int, error) { return n.dst.Write(p) } func (n *NoOp) Close() error { return nil } diff --git a/filter/mog.go b/filter/mog.go index e0cd757e..a14b1fe7 100644 --- a/filter/mog.go +++ b/filter/mog.go @@ -33,7 +33,6 @@ import ( "image" "image/color" "io" - "time" "gocv.io/x/gocv" ) @@ -52,9 +51,6 @@ type MOGFilter struct { hfCount int } -var frames int = 0 -var t1 = time.Now() - // NewMOGFilter returns a pointer to a new MOGFilter struct. func NewMOGFilter(dst io.WriteCloser, area, threshold float64, history int, debug bool, hf int) *MOGFilter { bs := gocv.NewBackgroundSubtractorMOG2WithParams(history, threshold, false) @@ -83,19 +79,9 @@ func (m *MOGFilter) Close() error { // Write applies the motion filter to the video stream. Only frames with motion // are written to the destination encoder, frames without are discarded. func (m *MOGFilter) Write(f []byte) (int, error) { - t2 := time.Now() - if frames == 0 { - t1 = time.Now() - } if m.hfCount < (m.hf - 1) { m.hold[m.hfCount] = f m.hfCount++ - frames++ - fmt.Printf("Hold in array 1 frame:\t%dms\n", time.Now().Sub(t2).Milliseconds()) - if frames >= 24 { - fmt.Printf("\t\t\t\t\t\t\t\t25 frames takes: %dms\n\n", time.Now().Sub(t1).Milliseconds()) - frames = 0 - } return 0, nil } @@ -150,12 +136,6 @@ func (m *MOGFilter) Write(f []byte) (int, error) { // Don't write to destination if there is no motion. if len(contours) == 0 { - frames++ - fmt.Printf("No motion 1 frame:\t%dms\n", time.Now().Sub(t2).Milliseconds()) - if frames >= 24 { - fmt.Printf("\t\t\t\t\t\t\t\t25 frames takes: %dms\n\n", time.Now().Sub(t1).Milliseconds()) - frames = 0 - } return 0, nil } @@ -167,12 +147,6 @@ func (m *MOGFilter) Write(f []byte) (int, error) { return 0, err } } - fmt.Printf("Motion 1 frame:\t\t%dms\n", time.Now().Sub(t2).Milliseconds()) - frames++ - if frames >= 24 { - fmt.Printf("\t\t\t\t\t\t\t\t25 frames takes: %dms\n\n", time.Now().Sub(t1).Milliseconds()) - frames = 0 - } return m.dst.Write(f) } diff --git a/revid/revid.go b/revid/revid.go index 820d10f7..26abdee3 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -32,7 +32,6 @@ import ( "errors" "fmt" "io" - "os" "os/exec" "strconv" "strings" @@ -345,15 +344,6 @@ func (r *Revid) setupPipeline(mtsEnc func(dst io.WriteCloser, rate float64) (io. r.encoders = multiWriter(encoders...) - // !!! Test code - //r.encoders = multiWriter(encoders...) - f, er := os.Create("vid.mjpeg") - if er != nil { - panic("!!! TEST CODE !!!: file didnt work") - } - r.encoders = f - // !!! Test code - l := len(r.cfg.Filters) r.filters = []filter.Filter{filter.NewNoOp(r.encoders)} if l != 0 {