TSINGSEE青犀视频云边端架构视频智能分析平台已经全面支持录像计划的设置,配置方法大家可以参考此文:EasyNVR边缘计算网关录像计划功能操作介绍。
TSINGSEE青犀视频云边端架构产品每天都在不间断测试当中,近期就发现EasyNVR视频平台在设置录像计划时,出现了关闭全局和单通道录像计划并在通道中配置录像天数为0后,平台仍然在录像的情况。
一、问题复现
- 把某通道开启全局和单通道录像计划,通道开始录像
- 进入该通道配置,把录像天数设置为0,然后关闭该通道的全局和单通道录像计划,观察该通道录像情况
二、问题分析
复现问题之后我们发现,该问题是在录像计划中出现的,于是找到检查录像是否能继续录像的地方。
func checkRecordPlan() gin.HandlerFunc {
return func(c *gin.Context) {
c.Request.ParseForm()
log.Printf("----------form:%s", c.Request.Form)
app := c.Request.Form.Get("app")
call := c.Request.Form.Get("call")
name := c.Request.Form.Get("name")
channelId, _ := strconv.Atoi(name[7:])
if app == "record" && (call == "update_publish" || call == "publish") {
var camera models.Camera
models.DB.Model(models.Camera{}).Where("id = ?", channelId).First(&camera)
recordDay, _ := strconv.Atoi(camera.Reserve3)
if recordDay != 0 {
if camera.RecordPlanEnable == 0 {
recordAllPlanEnable := utils.Conf().Section("base_config").Key("record_all_plan_enable").MustBool(false)
if recordAllPlanEnable {
recordAllPlan := utils.Conf().Section("base_config").Key("record_all_plan").MustString(""{"Monday":"00:00-23:59","Tuesday":"00:00-23:59","Wednesday":"00:00-23:59","Thursday":"00:00-23:59","Friday":"00:00-23:59","Saturday":"00:00-23:59","Sunday":"00:00-23:59"}"")
if recordAllPlan != "{"Monday":"","Tuesday":"","Wednesday":"","Thursday":"","Friday":"","Saturday":"","Sunday":""}" {
log.Printf("----------RecordAllPlan:%s", recordAllPlan)
if !checkTimeByRecordPlan(recordAllPlan) {
channelInfo := channels.GetChannel(uint(channelId))
channelInfo.StopRecordPusher()
c.AbortWithStatus(http.StatusBadRequest)
return
}
}
}
} else if camera.RecordPlanEnable == 1 {
if camera.RecordPlan != "{"Monday":"","Tuesday":"","Wednesday":"","Thursday":"","Friday":"","Saturday":"","Sunday":""}" {
log.Printf("----------RecordAllPlan:%s", camera.RecordPlan)
if !checkTimeByRecordPlan(camera.RecordPlan) {
channelInfo := channels.GetChannel(uint(channelId))
channelInfo.StopRecordPusher()
c.AbortWithStatus(http.StatusBadRequest)
return
}
}
}
}
}
c.Next()
}
}
该处代码就是判断录像天数是否为0的逻辑,如果不等于0才会去校验录像计划,如果等于0忘记做判断了。
在原代码中加上以下代码即可。
} else {
channelInfo := channels.GetChannel(uint(channelId))
channelInfo.StopRecordPusher()
c.AbortWithStatus(http.StatusBadRequest)
return
}
关于TSINNGSE青犀视频云边端视频智能分析平台EasyNVR,熟悉的用户都了解,该平台已经是一个完善的安防视频可视化平台了,同时为了将平台变得更加丰富,我们也还在对EasyNVR进行新的功能开发。如果大家感兴趣,欢迎自行下载试用或者直接联系我们咨询了解。