From 535d898a3c3cfa8f85d756365a72947b493947ee Mon Sep 17 00:00:00 2001 From: Saxon Milton Date: Wed, 31 Jan 2018 10:53:09 +1030 Subject: [PATCH] Finished commenting, now I can think about only testing --- revid/RevidInstance.go | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/revid/RevidInstance.go b/revid/RevidInstance.go index 782f2213..19273593 100644 --- a/revid/RevidInstance.go +++ b/revid/RevidInstance.go @@ -348,21 +348,21 @@ func (r *revidInst)readCamera() { r.Log(Info, "Out of reading routine!") } -// Stop +// Stop halts any processing of video func (r *revidInst) Stop() { if r.isRunning { r.Log(Info, "Stopping revid!") r.isRunning = false - r.cmd.Process.Kill() + if r.cmd != nil { + r.cmd.Process.Kill() + } } else { r.Log(Warning, "revidInst.Stop() called but revid not running!") } } -/* -New returns a pointer to a newly allocated RingBuffer with the parameters specified. -It initialises fields and allocates the required dataMemory. -*/ +// packClips takes data segments; whether that be tsPackets or jpeg frames and +// packs them into clips 1s long. func (r *revidInst) packClips() { clipSize := 0 packetCount := 0 @@ -421,10 +421,8 @@ func (r *revidInst) packClips() { } } -/* -New returns a pointer to a newly allocated RingBuffer with the parameters specified. -It initialises fields and allocates the required dataMemory. -*/ +// outputClips takes the clips produced in the packClips method and outputs them +// to the desired output defined in the revidInst config func (r *revidInst) outputClips() { now := time.Now() prevTime := now @@ -469,10 +467,7 @@ func (r *revidInst) outputClips() { } } -/* -New returns a pointer to a newly allocated RingBuffer with the parameters specified. -It initialises fields and allocates the required dataMemory. -*/ +// sendClipToHTTP takes a clip and an output url and posts through http. func (r *revidInst) sendClipToHTTP(clip []byte, output string) error { timeout := time.Duration(httpTimeOut * time.Second) client := http.Client{