Skip to content

fix(JitsiConference): handle mute state updates arriving before track creation#2956

Merged
jallamsetty1 merged 3 commits intojitsi:masterfrom
mihhu:mihhu/participant-mute
Jan 22, 2026
Merged

fix(JitsiConference): handle mute state updates arriving before track creation#2956
jallamsetty1 merged 3 commits intojitsi:masterfrom
mihhu:mihhu/participant-mute

Conversation

@mihhu
Copy link
Member

@mihhu mihhu commented Dec 22, 2025

Description

Fixes race condition where mute state updates can arrive via signaling before the corresponding remote track has been created, causing the initial TRACK_MUTE_CHANGED event to never be emitted.

How Has This Been Tested?

  • Manual testing with multiple sources per participant
  • Verified events fire on mute state transitions
  • Confirmed aggregate logic works correctly (unmuted if ANY source is unmuted)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@jitsi-jenkins
Copy link

Hi, thanks for your contribution!
If you haven't already done so, could you please make sure you sign our CLA (https://jitsi.org/icla for individuals and https://jitsi.org/ccla for corporations)? We would unfortunately be unable to merge your patch unless we have that piece :(.

   Adds TRACK_AUDIO_MUTED_CHANGED and TRACK_VIDEO_MUTED_CHANGED events that emit when a participant's aggregate mute state changes. A participant is considered unmuted
    if ANY source for that media type is unmuted.

   Also fixes bug where sources weren't added when media type map didn't exist.
@mihhu mihhu force-pushed the mihhu/participant-mute branch from 54261fd to bb85db9 Compare January 15, 2026 07:16
Copy link
Member

@saghul saghul left a comment

Choose a reason for hiding this comment

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

LGTM. @jallamsetty1 can you PTAL?

@saghul
Copy link
Member

saghul commented Jan 15, 2026

Jenkins please test this please.

@jallamsetty1
Copy link
Member

@mihhu The existing TRACK_MUTE_CHANGED events should fire for remote tracks as well. See

this.emit(JitsiTrackEvents.TRACK_MUTE_CHANGED, this);
and
() => emitter.emit(JitsiConferenceEvents.TRACK_MUTE_CHANGED, track));
. Maybe there is a bug somewhere if that is not happening now.

@mihhu mihhu changed the title feat(JitsiParticipant): Add participant-level mute state change events fix(JitsiConference): Emit TRACK_MUTE_CHANGED for initial remote track mute state Jan 20, 2026
@mihhu mihhu changed the title fix(JitsiConference): Emit TRACK_MUTE_CHANGED for initial remote track mute state fix(JitsiConference): handle mute state updates arriving before track creation Jan 21, 2026
);

emitter.emit(JitsiConferenceEvents.TRACK_ADDED, track);

Copy link
Member

@jallamsetty1 jallamsetty1 Jan 21, 2026

Choose a reason for hiding this comment

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

Suggested change
// Always apply the final mute state (pending or current).
const muteState = track._getPendingMuteState() ?? track.isMuted();
track._clearPendingMuteState();
track.setMute(muteState);

Copy link
Member

Choose a reason for hiding this comment

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

I am wondering if we should always call setMute() track. This should handle the case when presence is available during track creation and there are no subsequent mute events after that initial presence update.

Copy link
Member

Choose a reason for hiding this comment

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

nevermind, I think case is already handled.

@jallamsetty1 jallamsetty1 merged commit 916ebe5 into jitsi:master Jan 22, 2026
1 check passed
catFurr pushed a commit to alfaz-studio/lib-jitsi-meet that referenced this pull request Jan 23, 2026
…k creation (jitsi#2956)

* feat(JitsiParticipant): Add participant-level mute state change events

   Adds TRACK_AUDIO_MUTED_CHANGED and TRACK_VIDEO_MUTED_CHANGED events that emit when a participant's aggregate mute state changes. A participant is considered unmuted
    if ANY source for that media type is unmuted.

   Also fixes bug where sources weren't added when media type map didn't exist.

* fix(JitsiConference): Emit TRACK_MUTE_CHANGED for initial remote track mute state

* fix(JitsiConference): handle mute state updates arriving before track creation
mihhu added a commit that referenced this pull request Feb 2, 2026
mihhu added a commit that referenced this pull request Feb 3, 2026
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.

4 participants