Commit Graph
6 Commits
Author SHA1 Message Date
singhharsh1708 c3d7eb5839 fix: stop splitting av1 rtsp frames into h.265 fragments 2026-11-16 03:56:30 +05:30
Jash 9ac66f7d1d fix: set the RTP marker bit only on the last packet of an access unit refs #5886 2026-11-14 21:52:57 +05:30
Jash bd5d2d76af fix: set the FU end bit only on the last RTSP fragment of a NAL refs #5884 2026-11-14 20:23:11 +05:30
Claude 1dc0de1058 fix: drop superseded-generation media and join rtsp packers safely
Address rtsp consumer review findings:

- MonitorRtspStream drops media whose generation does not match the one
  the current xop session was built for. After a parameter change the
  reader thread records the new HELLO and generation before the main
  thread rebuilds the session; feeding that media to the old packer
  produced codec-mismatch output. Update() now also rebuilds on a
  generation change and treats audio as current only when its generation
  matches the video's, so an audio stream dropped at a generation bump is
  not rebuilt into the new session.
- Stop and join each packer's write thread (StopAndJoin) before deleting
  the source, while the object is still the most-derived type. The write
  thread calls the virtual PushFrame; joining only in the base destructor
  raced it against a call that had devolved to the pure base.
- Use 8 kHz as the G.711 timebase fallback when the HELLO omits the
  sample rate, rather than the AAC-oriented 44.1 kHz default.

refs #5143

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T4UcdJLt1bxwdpcigGxZRD
2026-09-19 23:00:24 +00:00
SteveGilvarryandClaude Fable 5 c14b58983e feat: drive rtsp server sessions from the monitor stream socket
zm_rtsp_server now consumes the per-monitor stream socket instead of
the media FIFOs; zm_monitor's FIFO output is now unconsumed in-tree.

Source classes: the FIFO read thread, 'ZM <size> <pts>' header parsing,
memmem resync scanning and 4KB chunk buffer are gone from
ZoneMinderStreamSource. Packets arrive via OnPacket(data, size, pts);
the NAL/OBU splitting, parameter-set extraction and FU fragmentation
logic is unchanged. Constructors lose the fifo path argument.

zm_rtsp_server.cpp: each monitor gets a MonitorRtspStream owning a
StreamSocketClient. Sessions are built from the HELLO handshake instead
of guessing: codec chosen by codec id (H264/HEVC/AV1, AAC/G711A/G711U)
rather than sniffing the fifo path extension, AAC sample rate and
channel count come from the HELLO rather than shared memory, and the
HELLO extradata primes the packers (replacing the FIFO's
extradata-before-keyframe rewrites). When stream parameters change -
camera reconfigure or zmc restart with a different codec - the session
is rebuilt; a condition variable wakes the main loop so rebuilds do not
wait out the 10s poll. The monitor poll loop, RTSPServer gating and
last-viewed accounting are retained.

Known limitation: xop RtspServer::RemoveSession in dep/RtspServer has
pre-existing thread-safety issues, so frequent runtime session
recreation (a camera whose parameters change often) should wait for a
fix in that dependency.

Tests: full suite 103/103 via ctest; all binaries build with no new
warnings.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-16 05:02:23 +10:00
SteveGilvarryandClaude Fable 5 9bd76fb100 refactor: rename rtsp server fifo sources to stream sources
Mechanical rename ahead of the transport swap: the source classes that
pack NALs/OBUs for the xop RTSP layer are about to be fed from the
monitor stream socket instead of the media FIFOs.

zm_rtsp_server_fifo_*.{h,cpp} -> zm_rtsp_server_stream_*.{h,cpp};
ZoneMinder*FifoSource -> ZoneMinder*StreamSource and codec subclasses to
match; include guards and CMake source list updated. No behavioural
change - the sources still read the FIFOs in this commit.

Tests: full build green; suite 103/103 via ctest.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-16 05:00:44 +10:00