mirror of https://bitbucket.org/ausocean/av.git
handling buffer full error better
This commit is contained in:
parent
7edf430f9a
commit
113293a3e0
|
@ -302,7 +302,10 @@ func (r *revid) packClips() {
|
||||||
if clip, err = r.ringBuffer.Get(); err != nil {
|
if clip, err = r.ringBuffer.Get(); err != nil {
|
||||||
r.Log(Error, err.Error())
|
r.Log(Error, err.Error())
|
||||||
r.Log(Warning, "Clearing output chan!")
|
r.Log(Warning, "Clearing output chan!")
|
||||||
r.flushData()
|
// Keep clearing output chan until out buffer has some space
|
||||||
|
for clip, err = r.ringBuffer.Get(); err != nil {
|
||||||
|
r.flushData()
|
||||||
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
for {
|
for {
|
||||||
|
@ -560,7 +563,7 @@ func (r *revid) readCamera() {
|
||||||
_, err := io.ReadFull(r.inputReader, data)
|
_, err := io.ReadFull(r.inputReader, data)
|
||||||
switch {
|
switch {
|
||||||
// We know this means we're getting nothing from the cam
|
// We know this means we're getting nothing from the cam
|
||||||
case err != nil && err.Error() == "EOF" && r.isRunning:
|
case ( err != nil && err.Error() == "EOF" && r.isRunning ) || ( err != nil && r.isRunning):
|
||||||
r.Log(Error, "No data from camera!")
|
r.Log(Error, "No data from camera!")
|
||||||
time.Sleep(cameraRetryPeriod)
|
time.Sleep(cameraRetryPeriod)
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue