From ec4f34b117244af4b3bdcfea08718ac4d02c49ca Mon Sep 17 00:00:00 2001 From: Russell Stanley Date: Fri, 18 Mar 2022 16:34:55 +1030 Subject: [PATCH] cmd/rv/probe.go address comments on latest commit --- cmd/rv/probe.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/rv/probe.go b/cmd/rv/probe.go index 1665579e..1b64a5b9 100644 --- a/cmd/rv/probe.go +++ b/cmd/rv/probe.go @@ -134,12 +134,14 @@ func (tp *turbidityProbe) Close() error { func (tp *turbidityProbe) turbidityCalculation() error { var imgs []gocv.Mat img := gocv.NewMat() + // Write byte array to a temp file. file, err := os.CreateTemp("temp", "video*.h264") if err != nil { return fmt.Errorf("failed to create temp file: %w", err) } tp.log.Log(logger.Debug, "writing to file", "buffer size(bytes)", tp.buffer.Len()) + _, err = file.Write(tp.buffer.Bytes()) if err != nil { return fmt.Errorf("failed to write to temporary file: %w", err)