feat(sip-video-bridge): introduce production-grade SIP → WebRTC video…#637
feat(sip-video-bridge): introduce production-grade SIP → WebRTC video…#637Nawaf-Almansour wants to merge 4 commits intolivekit:mainfrom
Conversation
… bridge with control plane, resilience, and adaptive media pipeline - Add full video bridge pipeline (SIP RTP → ingest → codec/router → transcode → publisher → LiveKit) - Implement H264 depacketizer/repacketizer with STAP-A and FU-A support - Introduce codec router (passthrough vs transcode) with dynamic switching - Add GPU-enabled transcoding with queue-based backpressure control - Implement adaptive bitrate and load-aware degradation strategies Session & Lifecycle: - Add session manager with lifecycle control and cleanup - Introduce explicit state machine with transition validation - Extract media pipeline into media_pipe abstraction - Add Redis-backed session store for distributed coordination Resilience & Control Plane: - Add circuit breaker (per-session and global) - Implement feature flags with tenant, region, and percentage rollout - Add dynamic config with runt - Add full video bridge pipeline (SIP RTP → ingest → codec/router → transcode → publisher → LiveKit) - Implement H264 depacketizer/repacketizer with STAP-A and FU-A support - Introduce bac- Implement H264 depacketizer/repacketizer with STAP-A and FU-A support - Introduce codec router (passthroughre- Introduce codec router (passthrough vs transcode) with dynamic switcio- Add GPU-enabled transcoding with queue-based backpresscing hooks - Implem- Implement adaptive bitrate and load-aware degradation strategiesif Session & Lifecycle: - Add session manager with lifecycle controP i- Add session manag b- Introduce explicit state machine with transition valiGP- Extract media pipeline into media_pipe abstraction - Add RSu- Add Redis-backed session store for distributed codi Resilience & Control Plane: - Add circuit breaker (per-sessrit- Add circuit breakerintegra- Implement feature flags with tenant, regionha- Add dynamic config with runt - Add full video bridge pipeline (SIPoo- Add full video bridge pipelwi- Implement H264 depacketizer/repacketizer with STAP-A and FU-A support - Introduce bac- Implement H264 depacol- Introduce bac- Implement H264 depacketizer/repacketizer with STAP-A ct- Introduce codec router (passthroughre- Introduce codec router (passthrough vs trans f- Implem- Implement adaptive bitrate and load-aware degradation strategiesif Session & Lifecycle: - Add session manager with lifecycle controP i- Add session manag b- IntroduceurSession & Lifecycle: -
|
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #637 +/- ##
===========================================
- Coverage 65.25% 52.06% -13.20%
===========================================
Files 51 74 +23
Lines 6588 11321 +4733
===========================================
+ Hits 4299 5894 +1595
- Misses 1915 4949 +3034
- Partials 374 478 +104 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dennwc
left a comment
There was a problem hiding this comment.
Hi @Nawaf-Almansour! Thank you for all the work you did to make this happen! This PR is really impressive, but also massive. Because of that, we won't be able to accept it in the current form.
Parts of it really belong to the media-sdk. It would be great if you could split media-related parts and move those to that project instead (as a first step).
Most of the code here is brand-new and doesn't reuse any of the existing code we have (e.g. SDP parsing and handling, session state storage). Ideally, existing components should be updated for supporting video (optionally), as opposed to rebuilding everything from scratch.
Having this project as a separate binary outside of our SIP audio-only bridge make sense, though. The requirements for this use case might be sufficiently different and it might not make sense to fuse these two implementations together.
But other parts that I mentioned above should be shared, if possible. Is that something you are willing to do to push this PR forward?
…re flags, config, and resilience - TestSessionLifecycleFlow: full state machine transitions (INIT→READY→STREAMING→DEGRADED→CLOSING→CLOSED) - TestFeatureFlagRolloutEvaluation: global toggle, percentage rollout, tenant/region overrides - TestDynamicConfigHotReload: runtime bitrate and timeout updates - TestSessionGuardAdmissionControl: per-caller limits, per-node caps, rate limiting - TestCircuitBreakerIntegration: trip/open/half-open/closed transitions with timing - TestConfigValidation: config constraints (port ranges, codec validation) - TestBridgeContextCancellation: graceful shutdown via context All 20 tests pass with -race detector. Improves code coverage for integration paths.
- TestSIPINVITEParsing: validate INVITE structure with H.264 SRTP - TestSIP200OKResponse: validate 200 OK response with SDP - TestRTPMediaFlow: validate RTP header and H.264 payload - TestRTCPFeedback: validate RTCP SR packets - TestSIPSessionLifecycle: simulate complete call flow (INVITE→200→ACK→RTP→BYE) - TestUDPPacketReception: test UDP socket communication - TestSIPErrorHandling: validate error scenarios (invalid SDP, missing codec, etc) All 8 tests pass. Enables testing without live SIP endpoints.
- TestH264NALUParsing: validate SPS, IDR, non-IDR NAL units - TestH264RTPPacketization: validate STAP-A (aggregation) and FU-A (fragmentation) - TestVideoStreamSimulation: simulate 30fps H.264 stream with keyframes - TestBitrateAdaptation: adaptive bitrate (2.5M→1.2M→2.5M based on loss) - TestKeyframeRequests: FIR/PLI keyframe request handling - TestVideoQualityMetrics: resolution, jitter, packet loss, latency - TestTranscodingPath: H.264→VP8 pipeline (47ms latency) - TestPassthroughPath: H.264→H.264 passthrough (10ms latency, no transcode) - TestPacketLossRecovery: handle lost packets with PLI requests - TestVideoCodecNegotiation: SDP codec selection - TestVideoFrameBuffer: jitter absorption and frame buffering - TestEndToEndVideoFlow: complete SIP→LiveKit call flow All 12 tests pass. Validates video codec, RTP, RTCP - TestH264NALUParsing: validat
… bridge with control plane, resilience, and adaptive media pipeline
Session & Lifecycle:
Resilience & Control Plane: