Merge branch 'RevidCLI' of https://bitbucket.org/ausocean/av/src into RevidCLI

This commit is contained in:
richardsonjack 2018-05-03 14:34:44 +09:30
commit e477ee8a65
2 changed files with 10 additions and 5 deletions

View File

@ -37,7 +37,7 @@ import (
"bitbucket.org/ausocean/av/revid"
"bitbucket.org/ausocean/utils/smartLogger"
"bitbucket.org/ausocean/IoT/pi/netsender"
"bitbucket.org/ausocean/iot/pi/netsender"
linuxproc "github.com/c9s/goprocinfo/linux"
)

View File

@ -256,7 +256,7 @@ func (r *revid) Start() {
if r.setupOutput != nil {
err := r.setupOutput()
if err != nil {
r.Log(Error, "Output setup didn't work!")
r.Log(Error, err.Error())
return
}
}
@ -382,6 +382,7 @@ func (r *revid) outputClips() {
r.Log(Debug,"About to send!")
err2 := r.sendClip(clip)
r.Log(Debug,"Finished send!")
for ; err2 != nil; errorCount++ {
r.Log(Warning, "Send failed trying again!")
// If the clip size is not bigger than the threshold then we classify
@ -402,6 +403,7 @@ func (r *revid) outputClips() {
r.Log(Error, err2.Error())
if r.config.Output == NativeRtmp && errorCount > 10 {
r.rtmpInst.EndSession()
r.rtmpInst = rtmp.NewRTMPSession(r.config.RtmpUrl, rtmpConnectionTimout)
err = r.rtmpInst.StartSession()
}
}
@ -515,7 +517,10 @@ func (r *revid) setupOutputForLibRtmp() error {
r.rtmpInst = rtmp.NewRTMPSession(r.config.RtmpUrl, rtmpConnectionTimout)
err = r.rtmpInst.StartSession()
}
return errors.New("Could not establish rtmp connection, check rtmp url!")
if err != nil {
return err
}
return err
}
// setupOutputForFile sets up an output file to output data to
@ -544,7 +549,7 @@ func (r *revid) setupInputForRaspivid() error {
"-fps", r.config.FrameRate,
"-ih",
"-g", r.config.IntraRefreshPeriod,
"-ro", r.config.Rotate,
// "-ro", r.config.Rotate,
)
case QuantizationOff:
r.cmd = exec.Command("raspivid",
@ -558,7 +563,7 @@ func (r *revid) setupInputForRaspivid() error {
"-fps", r.config.FrameRate,
"-ih",
"-g", r.config.IntraRefreshPeriod,
"-ro", r.config.Rotate,
// "-ro", r.config.Rotate,
)
}