Skip to content

Commit 84b063d

Browse files
committed
Only replace the participants list from the SFU event, ignore participants in the coordinator event
1 parent 03266e2 commit 84b063d

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

Packages/StreamVideo/Runtime/Core/Models/CallSession.cs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,17 @@ void IStateLoadableFrom<CallSessionResponseInternalDTO, CallSession>.LoadFromDto
5555
// CallSessionResponseInternalDTO usually (or always?) contains no participants. Participants are updated from the SFU join response
5656
// But SFU response can arrive before API response, so we can't override participants here because this clears the list
5757

58+
//StreamTODO: temp remove this. This seems to be only messing up the participants list. We're testing updating the participants only based on SFU data.
59+
// But we need to check how this will work with GetCall where there's not SFU connection
5860

59-
foreach (var dtoParticipant in dto.Participants)
60-
{
61-
var participant = cache.TryCreateOrUpdate(dtoParticipant);
62-
if (!_participants.Contains(participant))
63-
{
64-
_participants.Add(participant);
65-
}
66-
}
61+
// foreach (var dtoParticipant in dto.Participants)
62+
// {
63+
// var participant = cache.TryCreateOrUpdate(dtoParticipant);
64+
// if (!_participants.Contains(participant))
65+
// {
66+
// _participants.Add(participant);
67+
// }
68+
// }
6769

6870
// StreamTODO: figure out how to best handle this. Should we update it from coordinator or only the SFU
6971
//_participantsCountByRole.TryReplaceValuesFromDto(dto.ParticipantsCountByRole);
@@ -82,6 +84,9 @@ void IStateLoadableFrom<SfuCallState, CallSession>.LoadFromDto(SfuCallState dto,
8284
StartedAt = dto.StartedAt.ToDateTimeOffset();
8385
}
8486

87+
// Treat SFU as the most updated source of truth for participants
88+
_participants.Clear();
89+
8590
// dto.CallState.Participants may not contain all participants
8691
foreach (var dtoParticipant in dto.Participants)
8792
{

0 commit comments

Comments
 (0)