Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(remote-sources): update only when neccessary #14205

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions react/features/base/participants/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);

Expand Down