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

This commit is contained in:
richardsonjack 2018-05-02 10:38:17 +09:30
commit 78d42be3ba
3 changed files with 8 additions and 5 deletions

BIN
RevidCLI Executable file

Binary file not shown.

View File

@ -30,6 +30,7 @@ package revid
import ( import (
"errors" "errors"
"strconv" "strconv"
"fmt"
"bitbucket.org/ausocean/utils/smartLogger" "bitbucket.org/ausocean/utils/smartLogger"
//"../../utils/smartLogger" //"../../utils/smartLogger"
@ -57,6 +58,7 @@ type Config struct {
Quantization string Quantization string
Timeout string Timeout string
IntraRefreshPeriod string IntraRefreshPeriod string
Rotate string
Logger smartLogger.LogInstance Logger smartLogger.LogInstance
} }
@ -275,7 +277,7 @@ func (config *Config) Validate(r *revid) error {
} }
} }
if config.Rotate = "" { if config.Rotate == "" {
r.Log(Warning, fmt.Sprintf("No rotate defined defaulting to: %v", defaultRotate) ) r.Log(Warning, fmt.Sprintf("No rotate defined defaulting to: %v", defaultRotate) )
r.config.Rotate = defaultRotate r.config.Rotate = defaultRotate
} else { } else {

View File

@ -279,6 +279,7 @@ func (r *revid) Stop() {
if r.cmd != nil && r.cmd.Process != nil { if r.cmd != nil && r.cmd.Process != nil {
r.cmd.Process.Kill() r.cmd.Process.Kill()
} }
r.rtmpInst.EndSession()
} }
// getFrameNoPacketization gets a frame directly from the revid output chan // getFrameNoPacketization gets a frame directly from the revid output chan
@ -505,10 +506,10 @@ func (r *revid) setupOutputForFfmpegRtmp() error {
// setupOutputForLibRtmp sets up rtmp output using the wrapper for the c based // setupOutputForLibRtmp sets up rtmp output using the wrapper for the c based
// librtmp library - makes connection and starts comms etc. // librtmp library - makes connection and starts comms etc.
func (r *revid) setupOutputForLibRtmp() error { func (r *revid) setupOutputForLibRtmp() error {
for r.rtmpInst = rtmp.NewRTMPSession(r.config.RtmpUrl, rtmpConnectionTimout), r.rtmpInst = rtmp.NewRTMPSession(r.config.RtmpUrl, rtmpConnectionTimout)
err = r.rtmpInst.StartSession(), noOfTries := 0; err := r.rtmpInst.StartSession()
err != nil && noOfTries < rtmpConnectionMaxTries; noOfTries++ for noOfTries := 0; err != nil && noOfTries < rtmpConnectionMaxTries; noOfTries++ {
{ r.rtmpInst.EndSession()
r.Log(Error, err.Error()) r.Log(Error, err.Error())
r.Log(Info, "Trying to establish rtmp connection again!") r.Log(Info, "Trying to establish rtmp connection again!")
r.rtmpInst = rtmp.NewRTMPSession(r.config.RtmpUrl, rtmpConnectionTimout) r.rtmpInst = rtmp.NewRTMPSession(r.config.RtmpUrl, rtmpConnectionTimout)