Check for error immediately and skip publish if error occurred

Signed-off-by: eleniums <eleniums@yahoo.com>
This commit is contained in:
eleniums 2018-10-08 23:16:23 -07:00
parent 8f3b295f51
commit e23c01dd98
1 changed files with 3 additions and 2 deletions

View File

@ -816,11 +816,12 @@ func (d *Driver) processVideo() error {
for {
buf := make([]byte, 2048)
n, _, err := d.videoConn.ReadFromUDP(buf)
d.Publish(d.Event(VideoFrameEvent), buf[2:n])
if err != nil {
fmt.Println("Error: ", err)
continue
}
d.Publish(d.Event(VideoFrameEvent), buf[2:n])
}
}()