fix(llc): fix connection quality blanking after reconnect#1270
Conversation
📝 WalkthroughWalkthroughModifies participant state mapping in the SFU extensions to retain the last known connection quality when a reconnect produces an unspecified quality value, instead of resetting it. Adds a corresponding changelog entry documenting the fix. ChangesConnection Quality Fix
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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/sfu/sfu_extensions.dart`:
- Around line 65-68: The incremental SFU update paths still overwrite a known
connection quality with unspecified, which can clear the indicator after
reconnect. Update the logic in sfuConnectionQualityChanged and
sfuParticipantUpdated to preserve the previous value when the incoming
SfuParticipant.connectionQuality is SfuConnectionQuality.unspecified, using the
same fallback behavior already applied in toParticipantState or by extracting a
shared helper for the merge.
🪄 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: 73e41251-9f05-4321-8f26-f16f62dae63b
📒 Files selected for processing (2)
packages/stream_video/CHANGELOG.mdpackages/stream_video/lib/src/sfu/sfu_extensions.dart
| // Keep the last known quality to avoid the indicator blanking out on every reconnect. | ||
| connectionQuality: connectionQuality != SfuConnectionQuality.unspecified | ||
| ? connectionQuality | ||
| : (existing?.connectionQuality ?? SfuConnectionQuality.unspecified), |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Inspect how connectionQuality is updated across event handlers
rg -n -B3 -A10 'connectionQuality' packages/stream_video/lib/src/call/state/mixins/state_sfu_mixin.dartRepository: GetStream/stream-video-flutter
Length of output: 1394
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- state_sfu_mixin.dart outline ---'
ast-grep outline packages/stream_video/lib/src/call/state/mixins/state_sfu_mixin.dart --view expanded
echo
echo '--- sfu_extensions.dart outline ---'
ast-grep outline packages/stream_video/lib/src/sfu/sfu_extensions.dart --view expanded
echo
echo '--- relevant sections in state_sfu_mixin.dart ---'
sed -n '180,330p' packages/stream_video/lib/src/call/state/mixins/state_sfu_mixin.dart
echo
echo '--- relevant section in sfu_extensions.dart ---'
sed -n '1,140p' packages/stream_video/lib/src/sfu/sfu_extensions.dartRepository: GetStream/stream-video-flutter
Length of output: 9213
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- all usages of toParticipantState ---'
rg -n 'toParticipantState\(' packages/stream_video/lib/src
echo
echo '--- all usages of sfuParticipantUpdated / sfuConnectionQualityChanged ---'
rg -n 'sfuParticipantUpdated|sfuConnectionQualityChanged' packages/stream_video/lib/src
echo
echo '--- SfuParticipant model ---'
fd -a 'sfu_participant.dart|SfuParticipant.*\.dart' packages/stream_video/lib/src
echo
echo '--- connectionQuality fields in SFU event/model definitions ---'
rg -n 'connectionQuality|ConnectionQuality' packages/stream_video/lib/src/sfu packages/stream_video/lib/src/call
echo
echo '--- surrounding event dispatch / rebuild code in call state ---'
rg -n -B4 -A8 'callParticipants|copyWith\(.*connectionQuality|toParticipantState' packages/stream_video/lib/src/call packages/stream_video/lib/src/sfuRepository: GetStream/stream-video-flutter
Length of output: 50386
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- call_session reconnect / event handling context ---'
sed -n '650,730p' packages/stream_video/lib/src/call/session/call_session.dart
echo
echo '--- participant update event model and mapper ---'
sed -n '1,120p' packages/stream_video/lib/src/sfu/data/events/sfu_events.dart
echo
sed -n '240,310p' packages/stream_video/lib/src/sfu/data/events/sfu_event_mapper_extensions.dart
echo
echo '--- participant model copyWith and connectionQuality definition ---'
sed -n '1,140p' packages/stream_video/lib/src/sfu/data/models/sfu_participant.dartRepository: GetStream/stream-video-flutter
Length of output: 12651
Preserve connection quality in the incremental SFU update paths
toParticipantState keeps the last known quality on full rebuilds, but sfuConnectionQualityChanged and sfuParticipantUpdated still write the incoming value directly. Since SfuParticipant can carry SfuConnectionQuality.unspecified, either path can still blank the indicator after reconnect. Apply the same fallback here or centralize it in a shared helper.
🤖 Prompt for 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.
In `@packages/stream_video/lib/src/sfu/sfu_extensions.dart` around lines 65 - 68,
The incremental SFU update paths still overwrite a known connection quality with
unspecified, which can clear the indicator after reconnect. Update the logic in
sfuConnectionQualityChanged and sfuParticipantUpdated to preserve the previous
value when the incoming SfuParticipant.connectionQuality is
SfuConnectionQuality.unspecified, using the same fallback behavior already
applied in toParticipantState or by extracting a shared helper for the merge.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1270 +/- ##
==========================================
+ Coverage 10.16% 10.24% +0.08%
==========================================
Files 679 679
Lines 49765 49768 +3
==========================================
+ Hits 5059 5100 +41
+ Misses 44706 44668 -38 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary by CodeRabbit