From 8bd4ccd2d8ac080166207ffd5142633d433262fc Mon Sep 17 00:00:00 2001 From: cloudwebrtc Date: Mon, 15 Apr 2024 20:55:30 +0800 Subject: [PATCH] fix bug in handleParticipantDisconnect. --- lib/src/core/room.dart | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/src/core/room.dart b/lib/src/core/room.dart index 2ebcbf360..61f02a408 100644 --- a/lib/src/core/room.dart +++ b/lib/src/core/room.dart @@ -555,10 +555,8 @@ class Room extends DisposableChangeNotifier with EventsEmittable { final isNew = !_remoteParticipants.containsKey(info.identity); - if (info.state == lk_models.ParticipantInfo_State.DISCONNECTED && - !isNew) { - hasChanged = true; - await _handleParticipantDisconnect(info.identity); + if (info.state == lk_models.ParticipantInfo_State.DISCONNECTED) { + hasChanged = await _handleParticipantDisconnect(info.identity); continue; } @@ -697,15 +695,16 @@ class Room extends DisposableChangeNotifier with EventsEmittable { events.emit(event); } - Future _handleParticipantDisconnect(String identity) async { + Future _handleParticipantDisconnect(String identity) async { final participant = _remoteParticipants.remove(identity); if (participant == null) { - return; + return false; } await participant.removeAllPublishedTracks(notify: true); emitWhenConnected(ParticipantDisconnectedEvent(participant: participant)); + return true; } Future _sendSyncState() async {