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/av/revid"
"bitbucket.org/ausocean/utils/smartLogger" "bitbucket.org/ausocean/utils/smartLogger"
"bitbucket.org/ausocean/IoT/pi/netsender" "bitbucket.org/ausocean/iot/pi/netsender"
linuxproc "github.com/c9s/goprocinfo/linux" linuxproc "github.com/c9s/goprocinfo/linux"
) )

View File

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