Compare commits

...

1 Commits

Author SHA1 Message Date
Cedric Verstraeten
83ba7baa4b [release] v3.1.4
- hot-fix: preserve width and height of both main and sub stream
2024-01-10 17:06:49 +01:00
5 changed files with 24 additions and 40 deletions

View File

@@ -497,10 +497,18 @@ func (g *Golibrtsp) Start(ctx context.Context, streamType string, queue *packets
if errSPS == nil {
// Get width
g.Streams[g.VideoH264Index].Width = sps.Width()
configuration.Config.Capture.IPCamera.Width = sps.Width()
if streamType == "main" {
configuration.Config.Capture.IPCamera.Width = sps.Width()
} else if streamType == "sub" {
configuration.Config.Capture.IPCamera.SubWidth = sps.Width()
}
// Get height
g.Streams[g.VideoH264Index].Height = sps.Height()
configuration.Config.Capture.IPCamera.Height = sps.Height()
if streamType == "main" {
configuration.Config.Capture.IPCamera.Height = sps.Height()
} else if streamType == "sub" {
configuration.Config.Capture.IPCamera.SubHeight = sps.Height()
}
// Get FPS
g.Streams[g.VideoH264Index].FPS = sps.FPS()
g.VideoH264Forma.SPS = nalu

View File

@@ -206,42 +206,8 @@ func RunAgent(configDirectory string, configuration *models.Configuration, commu
height := videoSubStream.Height
// Set config values as well
configuration.Config.Capture.IPCamera.Width = width
configuration.Config.Capture.IPCamera.Height = height
}
if cameraSettings.RTSP != rtspUrl ||
cameraSettings.SubRTSP != subRtspUrl ||
cameraSettings.Width != width ||
cameraSettings.Height != height {
// TODO: this condition is used to reset the decoder when the camera settings change.
// The main idea is that you only set the decoder once, and then reuse it on each restart (no new memory allocation).
// However the stream settings of the camera might have been changed, and so the decoder might need to be reloaded.
// .... Not used for the moment ....
if cameraSettings.RTSP != "" && cameraSettings.SubRTSP != "" && cameraSettings.Initialized {
//decoder.Close()
//if subStreamEnabled {
// subDecoder.Close()
//}
}
// At some routines we will need to decode the image.
// Make sure its properly locked as we only have a single decoder.
log.Log.Info("components.Kerberos.RunAgent(): camera settings changed, reloading decoder")
//capture.GetVideoDecoder(decoder, streams)
//if subStreamEnabled {
// capture.GetVideoDecoder(subDecoder, subStreams)
//}
cameraSettings.RTSP = rtspUrl
cameraSettings.SubRTSP = subRtspUrl
cameraSettings.Width = width
cameraSettings.Height = height
cameraSettings.Initialized = true
} else {
log.Log.Info("components.Kerberos.RunAgent(): camera settings did not change, keeping decoder")
configuration.Config.Capture.IPCamera.SubWidth = width
configuration.Config.Capture.IPCamera.SubHeight = height
}
// We are creating a queue to store the RTSP frames in, these frames will be

View File

@@ -72,11 +72,14 @@ type Capture struct {
// IPCamera configuration, such as the RTSP url of the IPCamera and the FPS.
// Also includes ONVIF integration
type IPCamera struct {
RTSP string `json:"rtsp"`
Width int `json:"width"`
Height int `json:"height"`
FPS string `json:"fps"`
RTSP string `json:"rtsp"`
SubRTSP string `json:"sub_rtsp"`
SubWidth int `json:"sub_width"`
SubHeight int `json:"sub_height"`
SubFPS string `json:"sub_fps"`
ONVIF string `json:"onvif,omitempty" bson:"onvif"`
ONVIFXAddr string `json:"onvif_xaddr" bson:"onvif_xaddr"`
ONVIFUsername string `json:"onvif_username" bson:"onvif_username"`

View File

@@ -362,6 +362,13 @@ func HandleRequestConfig(mqttClient mqtt.Client, hubKey string, payload models.P
// Copy the config, as we don't want to share the encryption part.
deepCopy := configuration.Config
// We need a fix for the width and height if a substream.
// The ROI requires the width and height of the sub stream.
if configuration.Config.Capture.IPCamera.SubRTSP != "" {
deepCopy.Capture.IPCamera.Width = configuration.Config.Capture.IPCamera.SubWidth
deepCopy.Capture.IPCamera.Height = configuration.Config.Capture.IPCamera.SubHeight
}
var configMap map[string]interface{}
inrec, _ := json.Marshal(deepCopy)
json.Unmarshal(inrec, &configMap)

View File

@@ -100,7 +100,7 @@ class App extends React.Component {
</div>
)}
<div id="page-root">
<Sidebar logo={logo} title="Kerberos Agent" version="v3.1.3" mobile>
<Sidebar logo={logo} title="Kerberos Agent" version="v3.1.5" mobile>
<Profilebar
username={username}
email="support@kerberos.io"