Skip to content

[bug] Track published via SDP renegotiation never forwarded to subscribers — server OnTrack doesn't fire, publish times out at 30s (self-hosted) #1104

@ianagallardo7

Description

@ianagallardo7

Versions

  • livekit_client (Dart): 2.7.0
  • flutter_webrtc: 1.4.0 (libwebrtc m144)
  • livekit-server (self-hosted): 1.11.0 (also reproduced on 1.10.0)
  • Flutter: 3.41.4
  • iOS: 18.2 and 26.0 (both repro)
  • Devices: iPhone 13, iPhone 15 Pro, iPad mini 6
  • Topology: multi-PC (default, not single-PC mode)

What happens

  1. Host connects to Room, publishes camera + mic (initial offer). Works.

  2. Host taps "Share screen" → our native bridge presents RPSystemBroadcastPickerView → user taps Start Broadcast.

  3. iOS Broadcast Upload Extension starts pushing CMSampleBuffers via the Unix socket in the App Group container.

  4. SDK's BroadcastManager fires isBroadcasting=true. Our Dart code does NOT call setScreenShareEnabled(true) — we rely on SDK auto-publish (after removing our manual call, a race condition was resolved in a prior diagnostic loop).

    Room is configured with:

   RoomOptions(
     defaultScreenShareCaptureOptions: ScreenShareCaptureOptions(
       useiOSBroadcastExtension: true,
     ),
   )
  1. Client logs LocalTrackPublishedEvent for screenShareVideo — SDK side believes publish succeeded.
  2. Server side: receives SDP renegotiation (offer/answer pair completes cleanly, NO unhandled RTP, NO ICE errors, mid=3 video VP8 with simulcast layers q;h).
  3. Exactly 30s later: server fires publish time out from the supervisor (SetMaxSubscribedQuality + supervisor state machine). Track removed server-side. Viewer NEVER receives TrackSubscribed for screenShareVideo.

Confirmed NOT the cause

  • Network: UDP 50000-60000 open server-side; camera/mic over the same path work flawlessly.
  • ICE: candidates exchanged, transport stays connected.
  • SDP renegotiation: completes successfully on both sides.
  • Codec: VP8 (also tried H.264 via Room options) — same outcome.
  • Simulcast: reproduces with 1 layer too (manually reduced via defaultVideoPublishOptions).
  • Race condition with our bridge: a prior loop removed our manual setScreenShareEnabled call; SDK auto-publishes via its own BroadcastManager listener. Bug persists.
  • Identity / token permissions: subscriber token has wildcard subscribe permission; server logs show no permission denial.
  • Server version: reproduces identically on 1.10.0 and 1.11.0.

Suspected pattern

This matches webrtc-rs PR #750 ("Handle receiver reuse during renegotiation") in behavior — active receivers (camera) appear to cause the new transceiver for screen share to be marked NOT HANDLED. Is there an equivalent fix in pion-go currently shipping with livekit-server? Or in the SDK's add-track flow?

Questions

  1. Is this a known issue with publishing a 2nd video track via renegotiation while another video track is active in the same Room?
  2. Is singlePeerConnection mode planned for client-sdk-flutter? The Swift SDK exposes it (2.13.0+); we suspect single-PC mode would bypass this entirely.
  3. Is there a recommended workaround (e.g. pre-allocating transceivers at connect time, publish-order tricks, dynacast off, dummy track pre-publish)?
  4. Is there a way to disable the supervisor's hardcoded 30s publish timeout server-side while we diagnose?

Forensic data available on request

  • Full SDP offer + answer of the failing renegotiation
  • Timestamped client logs (both host and viewer side)
  • Server logs at debug level showing the 30s supervisor timeout
  • Confirmation of zero unhandled RTP packets during the broadcast window

Happy to share via secure channel or attach to this issue.

Impact

This blocks shipping screen share in our production live streaming application. We are not in a position to migrate to LiveKit Cloud or rewrite the host to Swift SDK. Looking for a workaround or fix timeline guidance.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions