mirror of https://bitbucket.org/ausocean/av.git
add go routine to write function
This commit is contained in:
parent
07c2472bdd
commit
b0f756a586
|
@ -195,15 +195,17 @@ func (tp *turbidityProbe) Write(p []byte) (int, error) {
|
|||
tp.log.Log(logger.Debug, "found frames", "frames", len(imgs))
|
||||
|
||||
// Process video data to get saturation and contrast scores.
|
||||
go func() {
|
||||
startTime := time.Now()
|
||||
res, err := tp.ts.Evaluate(imgs)
|
||||
tp.log.Log(logger.Debug, "finished evaluation", "total duration (sec)", time.Since(startTime).Seconds())
|
||||
if err != nil {
|
||||
tp.log.Error("evaluate failed", "error", err.Error())
|
||||
return len(p), err
|
||||
}
|
||||
} else {
|
||||
tp.log.Log(logger.Debug, "finished evaluation", "total duration (sec)", time.Since(startTime).Seconds())
|
||||
tp.contrast = stat.Mean(res.Contrast, nil)
|
||||
tp.sharpness = stat.Mean(res.Sharpness, nil)
|
||||
}
|
||||
}()
|
||||
default:
|
||||
return len(p), nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue