Merged
Conversation
Changes based on analysis of go2rtc's RTSP server implementation: 1. Use encoder timestamps instead of gettimeofday() for video PTS - Eliminates timestamp jitter caused by scheduling/queue delays - Anchors IMP encoder's monotonic microsecond clock to wall-clock - Greatly improves NVR compatibility (Frigate, HA, etc.) 2. Use non-blocking write() instead of write_wait() for RTSP frames - Prevents slow RTSP clients from stalling the encoder poll loop - Drop-oldest policy (like go2rtc) instead of blocking producer - Fixes cascading stalls affecting MP4 recording and video taps 3. Increase default OutPacketBuffer::maxSize from 500KB to 1MB - Prevents silent truncation of large IDR frames on high-res streams - Aligns with go2rtc's 1MB max buffer strategy 4. Add SO_SNDTIMEO on RTP sockets (configurable rtsp.send_timeout) - Detects and disconnects stalled/unresponsive RTSP clients - Default: 5 seconds (matches go2rtc's TCP write deadline) - Prevents indefinite hangs when client stops consuming data 5. Dynamic SDP regeneration on encoder config changes - Checks SPS/PPS/VPS against last known values on each DESCRIBE - Invalidates cached fSDPLines when codec config changes - Enables resolution/profile changes without RTSP server restart
…ntinuity SPS/PPS packs from IMP_Encoder_GetStream() may carry timestamp=0 while the IDR pack carries the real encoder timestamp. Using per-pack timestamps caused IMPDeviceSource's re-anchor logic to fire on SPS (delta < 0), then the IDR's full encoder-uptime timestamp produced a massive forward DTS jump. Fix: use nal_ts (last pack's timestamp) for all packs in VideoWorker. Defense-in-depth: add a >2s forward-jump guard in IMPDeviceSource that re-anchors on impossible per-frame deltas.
Per ONVIF Streaming Spec Section 5.3, backchannel tracks must be part of the main media session, not a separate endpoint. Add backchannel subsessions (AAC, PCMU, PCMA) to ch0's ServerMediaSession with a require tag so they only appear in the SDP when the client sends 'Require: www.onvif.org/ver20/backchannel' in the DESCRIBE request. Works with the corresponding live555 patch that adds: - generateSDPDescription() filtering by Require header - SETUP/PLAY fallback for clients that omit the stream prefix
Replace per-frame ERROR logs with rate-limited WARN that reports the count of dropped frames in the last 5-second window. Prevents log flooding when a slow consumer falls behind on audio or video channels.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.