Fix microphone muting immediately after joining a call#1626
Fix microphone muting immediately after joining a call#1626rahul-lohra wants to merge 3 commits intodevelopfrom
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
WalkthroughThis change adds a local microphone state validation during audio track publishing events. When an audio track is published, the code now checks if the microphone is enabled and automatically mutes the track and unpublishes the audio stream if the microphone is disabled. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 the current code and only fix it if needed.
Inline comments:
In
`@stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/call/RtcSession.kt`:
- Around line 1298-1303: The current block runs mute/unpublish for any published
audio track; restrict it to the local participant by adding a guard that only
runs this logic when the TrackPublishedEvent belongs to the local session (e.g.,
check event.participantId == localParticipant?.id or event.isLocal if available)
before calling setMuteState(isEnabled = false, event.trackType) and
publisher?.unpublishStream(event.trackType); keep the existing
TrackType.TRACK_TYPE_AUDIO check and use the existing symbols isMicEnabled,
setMuteState, publisher?.unpublishStream and event.trackType/event.participantId
or event.isLocal to locate and implement the guard.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 2a6fc701-1f11-487d-8318-9a7d22e3fa34
📒 Files selected for processing (1)
stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/call/RtcSession.kt
stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/call/RtcSession.kt
Show resolved
Hide resolved
SDK Size Comparison 📏
|
|



Goal
Fix: Microphone audio leaks to remote participants after muting on call join
Problem: When a user joins a call and turns off their microphone immediately, other participants can still hear them despite the mic being toggled off.
Implementation
Investigation
If the microphone is toggled between
JoinCallResponseEventandTrackPublishedEvent, the mute state is not correctly reflected to other participants.Microphone toggling works as expected after
TrackPublishedEventis received, where a subsequent mute action results in aTrackUnpublishedEventbeing emitted.Proposal -
After getting
TrackPublishedEventinRtcSession, we should check if mic is toggled off-or not. If set to off then set it to mute via🎨 UI Changes
None
Testing
StreamCallActivityappears and the microphone is visible as enabled, immediately toggle the mic off.TrackPublishedEventis received.Summary by CodeRabbit