mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-10-02 07:25:02 -04:00
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>
32 lines
1020 B
C++
32 lines
1020 B
C++
/* ---------------------------------------------------------------------------
|
|
** This software is in the public domain, furnished "as is", without technical
|
|
** support, and with no warranty, express or implied, as to its usefulness for
|
|
** any purpose.
|
|
**
|
|
**
|
|
** ZoneMinder Live555 source
|
|
**
|
|
** -------------------------------------------------------------------------*/
|
|
|
|
#include "zm_rtsp_server_stream_video_source.h"
|
|
|
|
#if HAVE_RTSP_SERVER
|
|
ZoneMinderStreamVideoSource::ZoneMinderStreamVideoSource(
|
|
std::shared_ptr<xop::RtspServer>& rtspServer,
|
|
xop::MediaSessionId sessionId,
|
|
xop::MediaChannelId channelId
|
|
) :
|
|
ZoneMinderStreamSource(rtspServer, sessionId, channelId),
|
|
m_width(0),
|
|
m_height(0) {
|
|
m_timeBase = {1, 90000};
|
|
}
|
|
|
|
void ZoneMinderStreamVideoSource::PushFrame(const uint8_t *data, size_t size, int64_t pts) {
|
|
xop::AVFrame frame(data, size);
|
|
frame.timestamp = av_rescale_q(pts, AV_TIME_BASE_Q, m_timeBase);
|
|
m_rtspServer->PushFrame(m_sessionId, m_channelId, frame);
|
|
}
|
|
|
|
#endif // HAVE_RTSP_SERVER
|