Improved logging

This commit is contained in:
Saxon Milton 2018-04-25 12:28:30 +09:30
parent 6f2cb19ab7
commit 2d812363cf
2 changed files with 11 additions and 1 deletions

View File

@ -36,6 +36,7 @@ import (
"time"
"bitbucket.org/ausocean/av/revid"
"bitbucket.org/ausocean/utils/smartLogger"
"bitbucket.org/ausocean/IoT/pi/netsender"
linuxproc "github.com/c9s/goprocinfo/linux"
@ -71,6 +72,7 @@ const (
noOfConfigconfigFlags = 19
revidStopTime = 5
prepTime = 20
loggerVerbosity = 3
)
const (
@ -220,6 +222,9 @@ func main() {
config.Timeout = *configFlags[timeoutPtr]
config.IntraRefreshPeriod = *configFlags[intraRefreshPeriodPtr]
// Also give the config a logger object
config.Logger = smartLogger.New(loggerVerbosity, smartLogger.White)
time.Sleep(time.Duration(prepTime) * time.Second)
createRevidInstance()
revidInst.Start()

View File

@ -60,7 +60,7 @@ const (
mp2tPacketSize = 188 // MPEG-TS packet size
mp2tMaxPackets = 2016 * clipDuration // # first multiple of 7 and 8 greater than 2000
ringBufferSize = 1000
ringBufferElementSize = 200000
ringBufferElementSize = 100000
httpTimeOut = 5 // s
packetsPerFrame = 7
h264BufferSize = 1000000
@ -319,6 +319,11 @@ func (r *revid) packClips() {
for {
frame := r.getFrame()
lenOfFrame := len(frame)
if lenOfFrame > ringBufferElementSize {
r.Log(Warning,"Frame was too big, getting another one!")
frame = r.getFrame()
lenOfFrame = len(frame)
}
upperBound := clipSize + lenOfFrame
copy(clip[clipSize:upperBound], frame)
packetCount++