diff --git a/machinery/src/capture/main.go b/machinery/src/capture/main.go
index 53a0c65..008b631 100644
--- a/machinery/src/capture/main.go
+++ b/machinery/src/capture/main.go
@@ -619,7 +619,9 @@ func Base64Image(captureDevice *Capture, communication *models.Communication) st
// We'll try to have a keyframe, if not we'll return an empty string.
var encodedImage string
- for {
+ // Try for 3 times in a row.
+ count := 0
+ for count < 3 {
if queue != nil && cursor != nil && rtspClient != nil {
pkt, err := cursor.ReadPacket()
if err == nil {
@@ -632,8 +634,10 @@ func Base64Image(captureDevice *Capture, communication *models.Communication) st
bytes, _ := utils.ImageToBytes(&img)
encodedImage = base64.StdEncoding.EncodeToString(bytes)
break
+ } else {
+ count++
+ continue
}
- break
}
} else {
break
@@ -660,6 +664,8 @@ func JpegImage(captureDevice *Capture, communication *models.Communication) imag
// We'll try to have a keyframe, if not we'll return an empty string.
var image image.YCbCr
+ // Try for 3 times in a row.
+ count := 0
for {
if queue != nil && cursor != nil && rtspClient != nil {
pkt, err := cursor.ReadPacket()
@@ -667,8 +673,13 @@ func JpegImage(captureDevice *Capture, communication *models.Communication) imag
if !pkt.IsKeyFrame {
continue
}
- image, _ = (*rtspClient).DecodePacket(pkt)
- break
+ image, err = (*rtspClient).DecodePacket(pkt)
+ if err != nil {
+ count++
+ continue
+ } else {
+ break
+ }
}
} else {
break
diff --git a/machinery/src/routers/websocket/main.go b/machinery/src/routers/websocket/main.go
index 1db4382..62c3dce 100644
--- a/machinery/src/routers/websocket/main.go
+++ b/machinery/src/routers/websocket/main.go
@@ -161,6 +161,8 @@ logreader:
if err == nil {
bytes, _ := utils.ImageToBytes(&img)
encodedImage = base64.StdEncoding.EncodeToString(bytes)
+ } else {
+ continue
}
} else {
log.Log.Error("routers.websocket.main.ForwardSDStream():" + err.Error())
diff --git a/ui/src/pages/Settings/Settings.jsx b/ui/src/pages/Settings/Settings.jsx
index 16d5786..e8ea083 100644
--- a/ui/src/pages/Settings/Settings.jsx
+++ b/ui/src/pages/Settings/Settings.jsx
@@ -1129,7 +1129,8 @@ class Settings extends React.Component {
}
/>
@@ -1349,7 +1352,8 @@ class Settings extends React.Component {
}
/>
@@ -1362,7 +1366,8 @@ class Settings extends React.Component {
}
/>
@@ -2296,7 +2301,8 @@ class Settings extends React.Component {
}
/>