diff --git a/revid/revid.go b/revid/revid.go index f7313b57..3e658312 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -120,10 +120,9 @@ type Revid struct { bitrate int // isRunning is a loaded and cocked foot-gun. + mu sync.Mutex isRunning bool - mu sync.Mutex - err chan error } @@ -192,7 +191,7 @@ func New(c Config, ns *netsender.Sender) (*Revid, error) { return &r, nil } -// TODO: put more thought into error severity +// TODO(Saxon): put more thought into error severity. func (r *Revid) handleErrors() { for { err := <-r.err @@ -319,7 +318,7 @@ func (r *Revid) reset(config Config) error { return nil } -// IsRunning returns whether the receiver is running. +// IsRunning returns true if revid is running. func (r *Revid) IsRunning() bool { r.mu.Lock() ret := r.isRunning @@ -327,6 +326,13 @@ func (r *Revid) IsRunning() bool { return ret } +// setIsRunning sets revid.isRunning using b. +func (r *Revid) setIsRunning(b bool) { + r.mu.Lock() + r.isRunning = b + r.mu.Unlock() +} + // Start invokes a Revid to start processing video from a defined input // and packetising (if theres packetization) to a defined output. func (r *Revid) Start() error { @@ -505,12 +511,6 @@ func (r *Revid) startRaspivid() error { return nil } -func (r *Revid) setIsRunning(b bool) { - r.mu.Lock() - r.isRunning = b - r.mu.Unlock() -} - func (r *Revid) startV4L() error { const defaultVideo = "/dev/video0"