Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(remote-sources): update only when neccessary

Hristo Terezovbd04f9b72b8c
diff --git a/react/features/base/participants/reducer.ts b/react/features/base/participants/reducer.ts
index 92d8fce399..98871fc848 100644
--- a/react/features/base/participants/reducer.ts
+++ b/react/features/base/participants/reducer.ts
@@ -374,23 +374,6 @@ ReducerRegistry.register<IParticipantsState>('features/base/participants',
let oldParticipant = remote.get(id);
let isLocalScreenShare = false;
- if (oldParticipant?.sources?.size) {
- const videoSources: Map<string, ISourceInfo> | undefined = oldParticipant.sources.get(MEDIA_TYPE.VIDEO);
- const newRemoteVideoSources = new Set(state.remoteVideoSources);
-
- if (videoSources?.size) {
- for (const source of videoSources.keys()) {
- newRemoteVideoSources.delete(source);
- }
- }
- state.remoteVideoSources = newRemoteVideoSources;
- } else if (oldParticipant?.fakeParticipant === FakeParticipant.RemoteScreenShare) {
- const newRemoteVideoSources = new Set(state.remoteVideoSources);
-
- newRemoteVideoSources.delete(id);
- state.remoteVideoSources = newRemoteVideoSources;
- }
-
if (oldParticipant && oldParticipant.conference === conference) {
remote.delete(id);
} else if (local?.id === id) {
@@ -405,6 +388,26 @@ ReducerRegistry.register<IParticipantsState>('features/base/participants',
return state;
}
+ if (oldParticipant?.sources?.size) {
+ const videoSources: Map<string, ISourceInfo> | undefined = oldParticipant.sources.get(MEDIA_TYPE.VIDEO);
+
+ if (videoSources?.size) {
+ const newRemoteVideoSources = new Set(state.remoteVideoSources);
+
+ for (const source of videoSources.keys()) {
+ newRemoteVideoSources.delete(source);
+ }
+
+ state.remoteVideoSources = newRemoteVideoSources;
+ }
+ } else if (oldParticipant?.fakeParticipant === FakeParticipant.RemoteScreenShare) {
+ const newRemoteVideoSources = new Set(state.remoteVideoSources);
+
+ if (newRemoteVideoSources.delete(id)) {
+ state.remoteVideoSources = newRemoteVideoSources;
+ }
+ }
+
state.sortedRemoteParticipants.delete(id);
state.raisedHandsQueue = state.raisedHandsQueue.filter(pid => pid.id !== id);