Skip to content

feat(sip-video-bridge): introduce production-grade SIP → WebRTC video…#637

Open
Nawaf-Almansour wants to merge 4 commits intolivekit:mainfrom
Nawaf-Almansour:sip-video-bridge
Open

feat(sip-video-bridge): introduce production-grade SIP → WebRTC video…#637
Nawaf-Almansour wants to merge 4 commits intolivekit:mainfrom
Nawaf-Almansour:sip-video-bridge

Conversation

@Nawaf-Almansour
Copy link
Copy Markdown

… 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: -

… 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:
-
@Nawaf-Almansour Nawaf-Almansour requested a review from a team as a code owner March 27, 2026 13:03
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

❌ Patch coverage is 28.97351% with 3003 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.06%. Comparing base (0460b40) to head (5255cd4).
⚠️ Report is 251 commits behind head on main.

Files with missing lines Patch % Lines
pkg/videobridge/bridge.go 0.00% 366 Missing ⚠️
pkg/videobridge/signaling/server.go 0.00% 212 Missing ⚠️
pkg/videobridge/transcode/transcode.go 0.00% 197 Missing ⚠️
pkg/videobridge/publisher/publisher.go 0.00% 193 Missing ⚠️
pkg/videobridge/ingest/rtp_receiver.go 0.00% 173 Missing ⚠️
pkg/videobridge/session/session.go 0.00% 132 Missing ⚠️
pkg/videobridge/transcode/gpu.go 0.00% 124 Missing ⚠️
pkg/videobridge/session/redis_store.go 0.00% 123 Missing ⚠️
pkg/videobridge/resilience/degradation.go 0.00% 118 Missing ⚠️
pkg/videobridge/transcode/queue.go 0.00% 115 Missing ⚠️
... and 28 more
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@dennwc dennwc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants