zhangmeng
2021-05-25 23c29d81f2c917bbb80fbfbeb285bb45a159331a
capture.go
@@ -38,8 +38,8 @@
   InvalidFileExt PicExt = PicExt("")
)
// Capture pic
func CaptureGB28181(soFile string, url string, maxTry int) ([]byte, error) {
// capture pic
func captureGB28181(soFile string, url string, maxTry int) ([]byte, error) {
   var ret []byte
   var err error
@@ -49,14 +49,14 @@
      return nil, err
   }
   reterr := errors.New(fmt.Sprintf("try %d times to capture image, is url correct?", maxTry))
   for i := 0; i < maxTry; i++ {
      ret = goffmpeg.GetGBJpg(url)
      if len(ret) > 0 {
         reterr = nil
         break
      }
   reterr := errors.New(fmt.Sprintf("gb28181 try %d times to capture image, is url correct?", maxTry))
   // for i := 0; i < maxTry; i++ {
   ret = goffmpeg.GetGBJpg(url, maxTry)
   if len(ret) > 0 {
      reterr = nil
      break
   }
   // }
   goffmpeg.FreeFFmpeg()
@@ -69,6 +69,10 @@
      return nil, errors.New("there is no this mode, try capture.Rtsp/capture.GB28181")
   }
   if m == GB28181 {
      return captureGB28181(soFile, url, maxTry)
   }
   if ext == InvalidFileExt {
      ext = JPEGFileExt
   }