RTSP/RTMP video image intelligent analysis technology platform EasyCVR adds channel CDN address update after CDN field loss troubleshooting

TSINGSEE Green Rhinoceros video image intelligent analysis technology platform EasyCVR can not only realize video stream scanning and link sharing, but also support push to CDN ( how EasyCVR pushes channel video stream to CDN for distribution ).

WeChat screenshot_20201127101659.png

There is a problem when EasyCVR pushes the video channel to the CDN, that is, when the user updates the channel after adding the channel CDN address, the CDN field will be lost.

After adding the CDN to the channel, here is the data:

18.png

The CDN field is lost after the update channel is executed:

19.png

At this time, the database CDN table fields are displayed as empty:

20.png

The investigation code found that when the channel is updated, the service will update all channels, including the CDN field, which will also update the old data, so that after the CDN field is configured, the channel is updated again, and the CDN field is lost.

Add the following code, call .Omit("enable_cdn", "cdn_url"), these two fields will be ignored when updating the database data, the reference code is as follows:


if len(gbschannels) == 0 {
       cvrChannel.Name = channel.Name
       tx.Model(cvrdo.DBChannelInfo{}).Omit("enable_cdn", "cdn_url").Save(cvrChannel)
} else {
       tmp, ret := cvrdao.GetChannelDao().Get(uint(gbschannels[0].Index))
       if ret != nil {
              cvrChannel.Name = gbschannels[0].Name
       } else {
              cvrChannel.ChannelID = tmp.ChannelID
              cvrChannel.EnableAudio = tmp.EnableAudio
              cvrChannel.Name = tmp.Name
              cvrChannel.Token = tmp.Token
              cvrChannel.RecordPlanNew = tmp.RecordPlanNew
              cvrChannel.RecordPlanSwitch = tmp.RecordPlanSwitch
              cvrChannel.RecordPlan = tmp.RecordPlan
       }
       tx.Model(cvrdo.DBChannelInfo{}).Omit("enable_cdn", "cdn_url").Save(cvrChannel)
}

After adjusting the code, configure the CDN address again, both before and after can be displayed normally, the problem has been resolved.

21.png

The EasyCVR video protocol integration platform not only supports the current mainstream video protocols, such as the national standard GB28181 and RTSP, but also supports device access of some private protocols, including HIKSDK and Ehome protocols. The private protocols of other mainstream manufacturers are also expanding and will be irregular. Add to. Among them, it is worth mentioning that EasyCVR can use GB28181 protocol for cascading in many outdoor scenes and multi-level platform projects, and the feature of multi-protocol integration will also play a role in many aspects.

Guess you like

Origin blog.csdn.net/TsingSee/article/details/115306148