Skip to content

chore(llc): improve ice candidate tracing - #1287

Open
Brazol wants to merge 3 commits into
mainfrom
fix/subscriber-negotiation-stall
Open

chore(llc): improve ice candidate tracing#1287
Brazol wants to merge 3 commits into
mainfrom
fix/subscriber-negotiation-stall

Conversation

@Brazol

@Brazol Brazol commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • ICE candidates can be buffered until a remote description is available.
    • Added connection tracing for pending, successful, and failed ICE candidate handling.
    • Updated Stream Chat Flutter dependency to 10.2.0.
  • Bug Fixes
    • Prevented ICE candidates from being dropped during mid-negotiation by improving remote-description/ICE synchronization.
    • Improved ICE candidate result handling across publisher and subscriber flows.
  • Tests
    • Expanded renegotiation/ICE buffering test coverage, including mid-operation and partial-flush scenarios.

@Brazol
Brazol requested a review from a team as a code owner July 22, 2026 19:57
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Brazol, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 6 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 84d77447-3208-409e-9dbf-8b131aa3725e

📥 Commits

Reviewing files that changed from the base of the PR and between d60e48d and 8b4d964.

📒 Files selected for processing (2)
  • packages/stream_video/lib/src/webrtc/peer_connection.dart
  • packages/stream_video/test/src/webrtc/peer_connection_renegotiation_test.dart
📝 Walkthrough

Walkthrough

The PR serializes WebRTC remote-description and ICE-candidate handling, adds buffered and applied outcomes with tracing and regression tests, removes media_kit_video from dogfooding desktop registration, and updates stream_chat_flutter to ^10.2.0.

Changes

WebRTC ICE candidate flow

Layer / File(s) Summary
Serialized ICE candidate buffering
packages/stream_video/lib/src/webrtc/peer_connection.dart
addIceCandidate now returns added or buffered, while synchronized remote-description updates flush candidates safely and retain failed or unattempted candidates for retry.
Manager propagation and outcome tracing
packages/stream_video/lib/src/webrtc/rtc_manager.dart, packages/stream_video/lib/src/webrtc/traced_peer_connection.dart, packages/stream_video/lib/src/call/stats/trace_tag.dart
Publisher and subscriber handling normalizes results, while tracing distinguishes pending, success, and error outcomes.
Buffering regression coverage and release note
packages/stream_video/test/src/webrtc/peer_connection_renegotiation_test.dart, packages/stream_video/CHANGELOG.md
Async tests cover in-flight candidate addition and partial flush retries, and the changelog records the fix.

Dogfooding desktop plugin cleanup

Layer / File(s) Summary
Generated plugin and dependency updates
dogfooding/linux/flutter/generated_plugin_registrant.cc, dogfooding/linux/flutter/generated_plugins.cmake, dogfooding/windows/flutter/generated_plugins.cmake, dogfooding/pubspec.yaml
Removes media_kit_video from Linux and Windows plugin registration and updates stream_chat_flutter to ^10.2.0.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant RtcManager
  participant TracedStreamPeerConnection
  participant StreamPeerConnection
  participant WebRTCPeer
  participant TraceTag
  RtcManager->>TracedStreamPeerConnection: addIceCandidate(candidate)
  TracedStreamPeerConnection->>StreamPeerConnection: addIceCandidate(candidate)
  StreamPeerConnection->>WebRTCPeer: check remote description
  WebRTCPeer-->>StreamPeerConnection: description present or absent
  StreamPeerConnection-->>TracedStreamPeerConnection: added or buffered result
  TracedStreamPeerConnection->>TraceTag: emit outcome-specific trace tag
  TracedStreamPeerConnection-->>RtcManager: normalized candidate result
Loading

Suggested reviewers: renefloor, xsahil03x

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning No PR description was provided, so none of the required Goal, Implementation, Testing, or checklist sections are filled in. Add the template sections for Goal, Implementation details, Testing, and the contributor/reviewer checklists, including any screenshots or test notes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is related to the main change and mentions the updated ICE-candidate tracing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/subscriber-negotiation-stall

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/stream_video/lib/src/webrtc/peer_connection.dart`:
- Around line 326-339: Serialize addIceCandidate and setRemoteDescription
through a shared async mutex or operation queue so remote-description checks,
buffering, and flushing cannot interleave. In the pending-candidate flush within
setRemoteDescription, remove each candidate from _pendingCandidates immediately
after its pc.addCandidate succeeds, preserving failed and unattempted candidates
for retry. Add tests for concurrent candidate arrival and partial flush failure.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fa875d6d-0c9f-4761-aa0d-e497b156d5f4

📥 Commits

Reviewing files that changed from the base of the PR and between d0b3a62 and a7aa4aa.

📒 Files selected for processing (8)
  • dogfooding/linux/flutter/generated_plugin_registrant.cc
  • dogfooding/linux/flutter/generated_plugins.cmake
  • dogfooding/pubspec.yaml
  • dogfooding/windows/flutter/generated_plugins.cmake
  • packages/stream_video/lib/src/call/stats/trace_tag.dart
  • packages/stream_video/lib/src/webrtc/peer_connection.dart
  • packages/stream_video/lib/src/webrtc/rtc_manager.dart
  • packages/stream_video/lib/src/webrtc/traced_peer_connection.dart
💤 Files with no reviewable changes (3)
  • dogfooding/linux/flutter/generated_plugins.cmake
  • dogfooding/windows/flutter/generated_plugins.cmake
  • dogfooding/linux/flutter/generated_plugin_registrant.cc

Comment thread packages/stream_video/lib/src/webrtc/peer_connection.dart Outdated
@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 42.30769% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 11.21%. Comparing base (d0b3a62) to head (8b4d964).

Files with missing lines Patch % Lines
...s/stream_video/lib/src/webrtc/peer_connection.dart 68.75% 5 Missing ⚠️
...kages/stream_video/lib/src/webrtc/rtc_manager.dart 0.00% 5 Missing ⚠️
...m_video/lib/src/webrtc/traced_peer_connection.dart 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1287      +/-   ##
==========================================
+ Coverage   11.20%   11.21%   +0.01%     
==========================================
  Files         686      686              
  Lines       50350    50357       +7     
==========================================
+ Hits         5640     5650      +10     
+ Misses      44710    44707       -3     

☔ View full report in Codecov by Harness.
📢 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.

Comment thread packages/stream_video/lib/src/webrtc/peer_connection.dart
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.

2 participants