- A closed recorder segment that no alarm wants is deleted as soon as a
later alarm cannot want it (pre-alarm time + 2 s), not kept 3 minutes.
Only the segment being recorded and, for a few seconds, the last closed
one are in <scratch>/stream_<node>.
- A segment around an alarm is moved (renamed) to <scratch>/<md5>.mp4 for
the kernel, which copies it into the report folder and deletes it; no
hard link to the recorder's file stays behind.
- Left-overs (crash, previous run): files in <scratch>/stream_* not
written for 30 s and not tracked are deleted at start-up and every minute.
- Stopping the recording (settings change, shutdown) deletes the remaining
segments and the empty stream folders.
- An alarm waits for its segments up to the segment length + 1 min (was a
fixed 3 min, too short for long segments).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0139veDo3XyavMuVhdnHcN16
When the embedded recorder writes segments (live_mode on, live_record on),
the alarm clips now come from those segments and the old encoder is not
started, so the video is no longer encoded and written twice.
- Recorder: ServerConf::onSegmentDone is called for every closed segment
(file, local start time, duration, size).
- kernelModuleEmbedVideo keeps the closed segments of each path for
3 minutes. An alarm (saveStreamPicture -> clipAlarm) hands over the
segments within 5 s before / 5 s after it to the kernel like the old
encoder's clips (hard link <scratch>/<md5>.mp4 + EVT_CAPTURE_DONE). The
event is bound to the segment it happened in, with its frame offset.
Old and left-over segments are deleted (sweepClips); the MediaMTX
helper no longer indexes or deletes them.
- With live_record off the old encoder makes the clips as before.
- streamHandler: no encoder thread in decode-only mode (it left an empty
segment file in the scratch folder per stream).
- VIDEO_SEGMENT_INFO of EVT_CAPTURE_DONE is a heap copy owned by the
receiver (mojoKernel deletes it). The old encoder memcpy'd a struct
with std::vector members (shared buffers) and leaked the copy.
- streamHandler: m_mEncodedProtector was unlocked every frame without
being locked when EVE_WORK_WITH_MEDIAMTX is defined.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0139veDo3XyavMuVhdnHcN16
- validate(): the settings-changed check was dead code after an early
return; it now runs first and reloads the module when the module_eve
row changes (e.g. from the Mojo_Web module settings).
- stopService() returned false with EVE_WORK_WITH_MEDIAMTX (m_bDetached
was only set by the picture server), so a reload stopped the streams
and never restarted them.
- Logo: computed position and state live in m_bLogoActive / m_nLogoX /
m_nLogoY instead of overwriting m_sEmbedVideoData (that made the struct
differ from the DB row and caused endless reloads). Logos without an
alpha channel no longer crash (whole picture drawn); ROI is checked.
- Time stamp: negative ts_x / ts_y are measured from the right / bottom
edge like label and logo; background box fits the text instead of the
fixed (490,60) corner.
- Font face and line type from the DB are sanitised before cv::putText
(an unsupported line type throws).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0139veDo3XyavMuVhdnHcN16
- Move reusable MediaMtx code (logger, codecs, stream, httpp, recorder,
webrtc server) to lib/data/media/mtx; add ServerConf, MediaPath/
PathProvider and H264Feeder. Standalone Projects/MediaMtx builds against it.
- kernelModuleEmbedVideo hosts a WHEP server (:8889/stream_<node>/whep)
and one MediaPath per camera stream with fMP4 segment recording.
- streamHandler feeds each path either with camera H264 passthrough
(videoAVLIBSource / videoLive555AVLibSource forward encoded NALs) or
with re-encoded processed frames incl. overlays (streamLiveEncoder),
selected by module_eve.live_mode (optional columns, defaults apply).
- kernelHelperMediaMTX: external mediamtx.service is stopped, segment
indexing of the scratch folder is kept.
- live555 watch variable type deduced so old and new live555 build.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0139veDo3XyavMuVhdnHcN16
A handler was registered in the basicEventHandler constructor (before
the derived members existed) and removed in its destructor (after they
were destroyed): the event heap could call dispatchEvent() on a half-
built or half-destroyed node or module when one was created or deleted
while la_mojo runs (node / module reload).
- Camera nodes (deviceNodePTZCamControl, deviceNodePresetCamControl,
deviceNodeStaticCamControl): basicEventHandler(false), attachEvents()
at the end of both constructors, detachEvents() first thing in the
destructor.
- Kernel modules: kernelModule no longer registers in its constructor;
kernelModuleFactory attaches a module right after creating it (all
modules are created there), before startService(). Every module
destructor (USB relay, Kafka, FlyHunter, SSDP, ONVIF observer, embed
video (both variants), modem manager, Bosch, attention cloud, report
backupper) calls detachEvents() first.
- basicEventHeap::moveHandlerTop/Bottom no longer register a handler
that is not registered (would have registered an object twice once
attachEvents() runs).
Sensor nodes are not event handlers and are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0139veDo3XyavMuVhdnHcN16