Skip to content

Mute sync resume no longer races the media replay - #1844

Merged
PratimMallick merged 4 commits into
developfrom
fix/and-1549-mute-resume-flush-races-replay
Oct 7, 2026
Merged

PratimMallick merged 4 commits into
developfrom
fix/and-1549-mute-resume-flush-races-replay

Conversation

@aleksandar-apostolov

@aleksandar-apostolov aleksandar-apostolov commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Goal

Fixes AND-1549

Follow-up to #1796.

Implementation

  • resumeMuteSync() only re-opens the muteSyncEnabled gate. The listenToMediaChanges()
    collectLatest replay is the single path that re-signals tracks after reconnect.
  • Removed pendingMuteSyncTracks and its bookkeeping in syncMuteStateToSfu(), cleanup()
    and cancelActiveWork().
  • Gate behaviour unchanged: collectors still record local bits while paused and still never
    post to a torn-down SFU.

Net -41 lines. No public API change.

Testing

  • ./gradlew :stream-video-android-core:testDebugUnitTest — 1270 passed, 0 failed
  • ./gradlew :stream-video-android-core:spotlessCheck :stream-video-android-core:apiCheck
  • RtcSessionTest2 gains mute sync resumes without replaying the tracks it skipped —
    verified it fails when the flush is reinstated.
  • Device repro from AND-1549 not yet re-run against this branch.

Summary by CodeRabbit

  • Bug Fixes
    • Improved mute-state synchronization when media publishing resumes.
    • Camera, microphone, and screen-share states are now re-sent through normal media-change handling, avoiding duplicate or stale synchronization updates.

resumeMuteSync flushed the tracks skipped while the SFU was being torn
down, then connectRtc restarted listenToMediaChanges and its collectLatest
replay re-signalled the same tracks milliseconds later. The same-track job
coalescing cancelled the flush mid-request, logging IOException: Canceled -
the symptom the gate was added to remove.

The replay already re-signals camera, microphone and screen-share on the
only path that reaches the flush, so resume now just re-opens the gate and
pendingMuteSyncTracks goes away with it.

Closes AND-1549
@aleksandar-apostolov aleksandar-apostolov added the pr:bug Fixes a bug label Sep 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled, or the PR is bot-authored.
  • An issue is linked (Linear ticket or GitHub issue), or the PR is bot-authored.

🎉 Great job! This PR is ready for review.

@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-video-android-core 12.38 MB 12.38 MB 0.00 MB 🟢
stream-video-android-ui-xml 5.68 MB 5.66 MB -0.02 MB 🚀
stream-video-android-ui-compose 6.19 MB 6.19 MB 0.00 MB 🟢

@aleksandar-apostolov
aleksandar-apostolov marked this pull request as ready for review September 22, 2026 09:12
@aleksandar-apostolov
aleksandar-apostolov requested a review from a team as a code owner September 22, 2026 09:12
@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 9736fa9a-b4b2-4e59-9174-bd0b819a44f1

📥 Commits

Reviewing files that changed from the base of the PR and between 49a9d83 and e88fe8a.

📒 Files selected for processing (2)
  • stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/call/RtcSession.kt
  • stream-video-android-core/src/test/kotlin/io/getstream/video/android/core/rtc/RtcSessionTest2.kt

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


Walkthrough

The change removes deferred mute-sync track storage. resumeMuteSync now only re-enables the sync gate. Media-change collection re-signals tracks after resumption, and tests verify the updated behavior.

Changes

Mute sync lifecycle

Layer / File(s) Summary
Mute sync gate and replay behavior
stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/call/RtcSession.kt
Removed pending-track storage and cleanup. Disabled sync now returns immediately. Resume only re-enables the sync gate.
Resume behavior validation
stream-video-android-core/src/test/kotlin/io/getstream/video/android/core/rtc/RtcSessionTest2.kt
Updated tests to verify that resume sends no immediate update and that later audio-track publication sends one update.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: pratimmallick

Merge Risk: ⚪ Minimal · up to e88fe

Mute sync now reopens safely and relies on reconnect media replay to update current track state. The reported tests pass, so the change is mergeable.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: preventing the mute-sync resume race with media replay.
Description check ✅ Passed The description includes the goal, implementation details, testing results, regression test coverage, and the remaining device-test limitation. UI, checklist, and reviewer sections are omitted, but th…
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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

A rabbit saw the mute gate glow
No waiting tracks remained below
The stream resumed with steps kept light
One fresh signal came through right
Ears up, the sync path now runs bright

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

@aleksandar-apostolov
aleksandar-apostolov marked this pull request as draft September 22, 2026 14:01
@aleksandar-apostolov
aleksandar-apostolov marked this pull request as ready for review October 5, 2026 08:03

@PratimMallick PratimMallick left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@sonarqubecloud

sonarqubecloud Bot commented Oct 7, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@PratimMallick
PratimMallick merged commit cb47ed3 into develop Oct 7, 2026
16 of 17 checks passed
@PratimMallick
PratimMallick deleted the fix/and-1549-mute-resume-flush-races-replay branch October 7, 2026 13:16
@stream-public-bot stream-public-bot added the released Included in a release label Oct 7, 2026
@stream-public-bot

Copy link
Copy Markdown
Collaborator

🚀 Available in v1.36.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:bug Fixes a bug released Included in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants