Skip to content

Commit 0041c21

Browse files
committed
don't update local participant state if user self-muted
1 parent 0915b80 commit 0041c21

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Packages/StreamVideo/Runtime/Core/LowLevelClient/RtcSession.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,11 +1098,12 @@ private void OnSfuTrackUnpublished(TrackUnpublished trackUnpublished)
10981098
var sessionId = trackUnpublished.SessionId;
10991099
var type = trackUnpublished.Type.ToPublicEnum();
11001100
var cause = trackUnpublished.Cause;
1101+
var updateLocalParticipantState = cause != TrackUnpublishReason.Unspecified && cause != TrackUnpublishReason.UserMuted;
11011102

11021103
// Optionally available. Read TrackUnpublished.participant comment in events.proto
11031104
var participantSfuDto = trackUnpublished.Participant;
11041105

1105-
UpdateParticipantTracksState(userId, sessionId, type, isEnabled: false, out var participant);
1106+
UpdateParticipantTracksState(userId, sessionId, type, isEnabled: false, updateLocalParticipantState, out var participant);
11061107

11071108
if (participantSfuDto != null && participant != null)
11081109
{
@@ -1123,7 +1124,7 @@ private void OnSfuTrackPublished(TrackPublished trackPublished)
11231124
// Optionally available. Read TrackUnpublished.participant comment in events.proto
11241125
var participantSfuDto = trackPublished.Participant;
11251126

1126-
UpdateParticipantTracksState(userId, sessionId, type, isEnabled: true, out var participant);
1127+
UpdateParticipantTracksState(userId, sessionId, type, isEnabled: true, updateLocalParticipantState: true, out var participant);
11271128

11281129
if (participantSfuDto != null && participant != null)
11291130
{
@@ -1136,7 +1137,7 @@ private void OnSfuTrackPublished(TrackPublished trackPublished)
11361137
}
11371138

11381139
private void UpdateParticipantTracksState(string userId, string sessionId, TrackType trackType, bool isEnabled,
1139-
out StreamVideoCallParticipant participant)
1140+
bool updateLocalParticipantState, out StreamVideoCallParticipant participant)
11401141
{
11411142
participant = (StreamVideoCallParticipant)ActiveCall.Participants.FirstOrDefault(p
11421143
=> p.SessionId == sessionId);
@@ -1146,7 +1147,7 @@ private void UpdateParticipantTracksState(string userId, string sessionId, Track
11461147
return;
11471148
}
11481149

1149-
if (participant.IsLocalParticipant)
1150+
if (participant.IsLocalParticipant && updateLocalParticipantState)
11501151
{
11511152
//StreamTODO: most probably expose RtcSession TrackStateChanged event so that AudioDeviceManager can subscribe
11521153

0 commit comments

Comments
 (0)