Check for error immediately and skip publish if error occurred
Signed-off-by: eleniums <eleniums@yahoo.com>
This commit is contained in:
parent
8f3b295f51
commit
e23c01dd98
|
@ -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])
|
||||
}
|
||||
}()
|
||||
|
||||
|
|
Loading…
Reference in New Issue