cmd/rv/probe.go address comments on latest commit

This commit is contained in:
Russell Stanley 2022-03-18 16:34:55 +10:30
parent 8e06cffade
commit ec4f34b117
1 changed files with 2 additions and 0 deletions

View File

@ -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)