Skip to content

Commit 060c84d

Browse files
authored
Revert "fix(JitsiConference): handles mute state updates arriving before track creation (#2956)" (#2974)
This reverts commit 916ebe5.
1 parent e9887c2 commit 060c84d

File tree

3 files changed

+2
-71
lines changed

3 files changed

+2
-71
lines changed

JitsiConference.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3546,16 +3546,6 @@ export default class JitsiConference extends Listenable {
35463546
);
35473547

35483548
emitter.emit(JitsiConferenceEvents.TRACK_ADDED, track);
3549-
3550-
// Apply any pending mute state that arrived before the track was created
3551-
// Always call setMute when there's a pending state, even if it matches current state,
3552-
// because setMute() is designed to emit on the first call regardless of state change
3553-
const pendingMutedState = track._getPendingMuteState();
3554-
3555-
if (pendingMutedState !== undefined) {
3556-
track._clearPendingMuteState();
3557-
track.setMute(pendingMutedState);
3558-
}
35593549
}
35603550

35613551

modules/RTC/JitsiRemoteTrack.ts

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ export default class JitsiRemoteTrack extends JitsiTrack {
4747
private _rtc: RTC;
4848
private _muted: boolean;
4949
private _hasBeenMuted: boolean;
50-
private _setMuteCalled: boolean;
5150
private _ssrc: number;
52-
private _pendingMuteState?: boolean;
5351

5452
public ownerEndpointId: string;
5553
public isP2P: boolean;
@@ -103,7 +101,6 @@ export default class JitsiRemoteTrack extends JitsiTrack {
103101
this._ssrc = ssrc;
104102
this.ownerEndpointId = ownerEndpointId;
105103
this._muted = muted;
106-
this._setMuteCalled = false;
107104
this.isP2P = isP2P;
108105
this._sourceName = sourceName;
109106
this._trackStreamingStatus = null;
@@ -426,37 +423,6 @@ export default class JitsiRemoteTrack extends JitsiTrack {
426423
return this._enteredForwardedSourcesTimestamp;
427424
}
428425

429-
/**
430-
* Sets the pending mute state for this track,
431-
* received before the track was fully initialized.
432-
*
433-
* @param {boolean | undefined} state - The pending mute state
434-
* @internal
435-
*/
436-
_setPendingMuteState(state: boolean | undefined): void {
437-
this._pendingMuteState = state;
438-
}
439-
440-
/**
441-
* Returns the pending mute state for this track,
442-
* received before the track was fully initialized.
443-
*
444-
* @returns {boolean | undefined} the pending mute state
445-
* @internal
446-
*/
447-
_getPendingMuteState(): boolean | undefined {
448-
return this._pendingMuteState;
449-
}
450-
451-
/**
452-
* Clears the pending mute state for this track.
453-
*
454-
* @internal
455-
*/
456-
_clearPendingMuteState(): void {
457-
this._pendingMuteState = undefined;
458-
}
459-
460426
/**
461427
* Removes attached event listeners and dispose TrackStreamingStatus .
462428
*
@@ -478,16 +444,10 @@ export default class JitsiRemoteTrack extends JitsiTrack {
478444
* @internal
479445
*/
480446
setMute(value: boolean): void {
481-
const isFirstCall = !this._setMuteCalled;
482-
const stateChanged = this._muted !== value;
483-
484-
// Skip if state didn't change, unless this is the first call (to emit initial state)
485-
if (!stateChanged && !isFirstCall) {
447+
if (this._muted === value) {
486448
return;
487449
}
488450

489-
this._setMuteCalled = true;
490-
491451
if (value) {
492452
this._hasBeenMuted = true;
493453
}

modules/RTC/TraceablePeerConnection.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ export default class TraceablePeerConnection {
157157
private _pcId: string;
158158
private _remoteUfrag: string;
159159
private _signalingLayer: SignalingLayer;
160-
private _pendingMuteUpdates: Map<string, boolean>;
161160
/**
162161
* @internal
163162
*/
@@ -325,13 +324,6 @@ export default class TraceablePeerConnection {
325324
*/
326325
this.remoteTracks = new Map();
327326

328-
/**
329-
* Stores pending mute updates for sources that haven't had tracks created yet.
330-
* @type {Map<string, boolean>}
331-
* @private
332-
*/
333-
this._pendingMuteUpdates = new Map();
334-
335327
/**
336328
* A map which stores local tracks mapped by {@link JitsiLocalTrack.rtcId}
337329
* @type {Map<number, JitsiLocalTrack>}
@@ -1211,14 +1203,11 @@ export default class TraceablePeerConnection {
12111203
const track = this.getRemoteTracks().slice().reverse().find(t => t.getSourceName() === sourceName);
12121204

12131205
if (!track) {
1214-
// Store the pending mute update to be applied when the track is created
1215-
this._pendingMuteUpdates.set(sourceName, isMuted);
1206+
logger.debug(`Remote track not found for source=${sourceName}, mute update failed!`);
12161207

12171208
return;
12181209
}
12191210

1220-
// Clear any pending mute update since we're applying the current state to an existing track
1221-
this._pendingMuteUpdates.delete(sourceName);
12221211
track.setMute(isMuted);
12231212
}
12241213

@@ -1703,14 +1692,6 @@ export default class TraceablePeerConnection {
17031692
userTracksByMediaType.add(remoteTrack);
17041693
}
17051694

1706-
// Store pending mute update on the track itself so JitsiConference can apply it after attaching listeners
1707-
if (this._pendingMuteUpdates.has(sourceName)) {
1708-
const pendingMutedState = this._pendingMuteUpdates.get(sourceName);
1709-
1710-
remoteTrack._setPendingMuteState(pendingMutedState);
1711-
this._pendingMuteUpdates.delete(sourceName);
1712-
}
1713-
17141695
this.eventEmitter.emit(RTCEvents.REMOTE_TRACK_ADDED, remoteTrack, this);
17151696
}
17161697

0 commit comments

Comments
 (0)