You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.4 KiB

​
​
​
​
​
​
Camera: re-create only the PTZ protocol on ONVIF trouble, keep the node and its stream A pOnvif problem could delete and re-create the whole camera node, which dropped the video stream bound to it, so recordings were cut although the video was fine. deviceNodeCamera::validate() compared the whole camera record with memcmp; any difference rebuilt the node: - CAM_WS_INIT sets m_sCamData.online = false before re-creating the PTZ protocol and writes the DB only afterwards. A validate() during a slow ONVIF re-init saw "online" differ and deleted the camera mid-re-init. - The ONVIF discovery (updateIPCam) wrote online=1 and the whole XAddrs list into onvif_ctrl (the web UI and la_mojo store only the path), so the record changed on discovery rounds. - A failed read (SQLite busy, queries fail at once) returned NULL = "camera deleted". Now: - Field classes (camDataChange): - runtime and discovery fields (online, status, session, max_range, uuid, mac): ignored; - name and hardware: taken over; - PTZ access (onvif_ctrl, onvif_access, port, auth_mode, ptz_token): the camera thread re-creates only the PTZ protocol, keeping the node and the stream; - anything else (ip and credentials used by the stream, stream_id, type, geometry, ...): rebuild as before, logged with the reason. - A lasting PTZ problem rebuilds the camera only after CAM_REBUILD_AFTER_FAILED_INITS (10) failed protocol initialisations in a row (several minutes with the retry back-off). - Node / camera record not read: rebuild only after NODE_DATA_MISSES_TO_REBUILD (3) validations in a row, for all nodes (deviceNode::validate). - updateIPCam: onvif_ctrl = path of the first XAddr. Host and port come from the first XAddr only: ':' was searched in the whole list, so a second, IPv6 XAddr gave a broken IP. A result without an address doesn't wipe the IP. Tested (functions extracted unchanged): camDataChange classifies online / status / max_range / uuid / mac as ignored, rename as cosmetic, port / onvif_ctrl / auth / ptz token as PTZ re-init, and ip / password / stream / geometry as rebuild. The XAddrs parser was checked with a port, without a port, with an IPv6 second XAddr, with a query, and with no address. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139veDo3XyavMuVhdnHcN16
5 hours ago
​
​
​
​
​
​
​
​
​
​
​
​
Camera: re-create only the PTZ protocol on ONVIF trouble, keep the node and its stream A pOnvif problem could delete and re-create the whole camera node, which dropped the video stream bound to it, so recordings were cut although the video was fine. deviceNodeCamera::validate() compared the whole camera record with memcmp; any difference rebuilt the node: - CAM_WS_INIT sets m_sCamData.online = false before re-creating the PTZ protocol and writes the DB only afterwards. A validate() during a slow ONVIF re-init saw "online" differ and deleted the camera mid-re-init. - The ONVIF discovery (updateIPCam) wrote online=1 and the whole XAddrs list into onvif_ctrl (the web UI and la_mojo store only the path), so the record changed on discovery rounds. - A failed read (SQLite busy, queries fail at once) returned NULL = "camera deleted". Now: - Field classes (camDataChange): - runtime and discovery fields (online, status, session, max_range, uuid, mac): ignored; - name and hardware: taken over; - PTZ access (onvif_ctrl, onvif_access, port, auth_mode, ptz_token): the camera thread re-creates only the PTZ protocol, keeping the node and the stream; - anything else (ip and credentials used by the stream, stream_id, type, geometry, ...): rebuild as before, logged with the reason. - A lasting PTZ problem rebuilds the camera only after CAM_REBUILD_AFTER_FAILED_INITS (10) failed protocol initialisations in a row (several minutes with the retry back-off). - Node / camera record not read: rebuild only after NODE_DATA_MISSES_TO_REBUILD (3) validations in a row, for all nodes (deviceNode::validate). - updateIPCam: onvif_ctrl = path of the first XAddr. Host and port come from the first XAddr only: ':' was searched in the whole list, so a second, IPv6 XAddr gave a broken IP. A result without an address doesn't wipe the IP. Tested (functions extracted unchanged): camDataChange classifies online / status / max_range / uuid / mac as ignored, rename as cosmetic, port / onvif_ctrl / auth / ptz token as PTZ re-init, and ip / password / stream / geometry as rebuild. The XAddrs parser was checked with a port, without a port, with an IPv6 second XAddr, with a query, and with no address. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139veDo3XyavMuVhdnHcN16
5 hours ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __DEVICE_NODE_HEADER__
  2. #define __DEVICE_NODE_HEADER__
  3. #include "../../components/base/basicEngine.h"
  4. #include "../../components/base/basicEvent.h"
  5. #include "cmdNodeConveyor.h"
  6. // The node record must be missing this many validations in a row before the node is deleted: a single failed
  7. // read (SQLite busy - queries fail at once, no busy wait) deleted the node (a camera dropped its stream)
  8. #ifndef NODE_DATA_MISSES_TO_REBUILD
  9. #define NODE_DATA_MISSES_TO_REBUILD 3
  10. #endif
  11. class deviceNode : public cmdNodeConveyor, public basicEngine
  12. {
  13. private:
  14. protected:
  15. basicLogCollection * m_pLog;
  16. dataBinder * m_pDBC;
  17. DBC_NODE_DATA m_sNodeData;
  18. uint8_t m_nNodeDataMisses; // validate(): node record not read N times in a row
  19. public:
  20. explicit deviceNode(uint32_t id);
  21. explicit deviceNode(DBC_NODE_DATA * Data);
  22. virtual ~deviceNode();
  23. uint32_t getNodeID() const
  24. {
  25. return m_sNodeData.node_id;
  26. }
  27. uint32_t getDeviceID() const
  28. {
  29. return m_sNodeData.aux_id;
  30. }
  31. uint32_t getDeviceParam() const
  32. {
  33. return m_sNodeData.aux_parameter;
  34. }
  35. ARGUS_NODE_TYPE getNodeType() const
  36. {
  37. return (ARGUS_NODE_TYPE) m_sNodeData.type;
  38. }
  39. bool isNodeOnline(void) const
  40. {
  41. return m_sNodeData.online;
  42. }
  43. virtual bool reset()
  44. {
  45. return false;
  46. }
  47. virtual bool validate();
  48. };
  49. typedef std::vector<deviceNode *> vectorDeviceNodes;
  50. typedef std::map<uint32_t, deviceNode *> mapDeviceNode2Id;
  51. #endif