revid/revid.go: moved revid.mu declaration

. Updated todo owner
This commit is contained in:
saxon 2019-02-01 10:07:00 +10:30
parent d26aa8643a
commit 9bddf343f5
1 changed files with 10 additions and 10 deletions

View File

@ -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"