Skip to content

fix(llc): fix connection quality blanking after reconnect#1270

Open
Brazol wants to merge 1 commit into
mainfrom
fix/fix-connection-quality-blanking
Open

fix(llc): fix connection quality blanking after reconnect#1270
Brazol wants to merge 1 commit into
mainfrom
fix/fix-connection-quality-blanking

Conversation

@Brazol

@Brazol Brazol commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • The connection quality indicator now stays visible after a reconnect instead of briefly clearing.
    • Connection quality is preserved more reliably when reconnecting, reducing flicker in participant status.

@Brazol Brazol requested a review from a team as a code owner July 6, 2026 15:28
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Modifies 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.

Changes

Connection Quality Fix

Layer / File(s) Summary
Preserve last known connection quality
packages/stream_video/lib/src/sfu/sfu_extensions.dart, packages/stream_video/CHANGELOG.md
Imports the SfuConnectionQuality model and updates the connectionQuality assignment to retain the existing participant's quality when the incoming value is unspecified, defaulting to unspecified only if no prior value exists; documents the fix in the changelog.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: xsahil03x

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning No pull request description was provided, so the required Goal, Implementation, and Testing sections are missing. Add the repository's PR template sections and briefly describe the goal, implementation, UI changes if any, testing, and checklist items.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: preserving connection quality after reconnects.
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/fix-connection-quality-blanking

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/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

📥 Commits

Reviewing files that changed from the base of the PR and between a5eeb44 and f8d0283.

📒 Files selected for processing (2)
  • packages/stream_video/CHANGELOG.md
  • packages/stream_video/lib/src/sfu/sfu_extensions.dart

Comment on lines +65 to +68
// Keep the last known quality to avoid the indicator blanking out on every reconnect.
connectionQuality: connectionQuality != SfuConnectionQuality.unspecified
? connectionQuality
: (existing?.connectionQuality ?? SfuConnectionQuality.unspecified),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 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.dart

Repository: 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.dart

Repository: 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/sfu

Repository: 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.dart

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

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 10.24%. Comparing base (a5eeb44) to head (f8d0283).

Files with missing lines Patch % Lines
...kages/stream_video/lib/src/sfu/sfu_extensions.dart 0.00% 3 Missing ⚠️
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.
📢 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.

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.

1 participant