From ec6abc1ce9f6f225fe83541df83d8e5f2df28ff4 Mon Sep 17 00:00:00 2001 From: damencho Date: Tue, 15 Dec 2020 10:00:07 -0600 Subject: [PATCH] fix: Skip sending unnecessary signalling for raise hand. --- .../features/base/participants/middleware.js | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/react/features/base/participants/middleware.js b/react/features/base/participants/middleware.js index ec762e7a89..2599a5d05b 100644 --- a/react/features/base/participants/middleware.js +++ b/react/features/base/participants/middleware.js @@ -71,16 +71,24 @@ MiddlewareRegistry.register(store => next => action => { break; case DOMINANT_SPEAKER_CHANGED: { - // Ensure the raised hand state is cleared for the dominant speaker. + // Ensure the raised hand state is cleared for the dominant speaker + // and only if it was set when this is the local participant const { conference, id } = action.participant; const participant = getLocalParticipant(store.getState()); + const isLocal = participant && participant.id === id; + + if (isLocal && participant.raisedHand === undefined) { + // if local was undefined, let's leave it like that + // avoids sending unnecessary presence updates + break; + } participant && store.dispatch(participantUpdated({ conference, id, - local: participant.id === id, + local: isLocal, raisedHand: false })); @@ -369,10 +377,10 @@ function _participantJoinedOrUpdated(store, next, action) { if (local) { const { conference } = getState()['features/base/conference']; - conference - && conference.setLocalParticipantProperty( - 'raisedHand', - raisedHand); + // Send raisedHand signalling only if there is a change + if (conference && raisedHand !== getLocalParticipant(getState()).raisedHand) { + conference.setLocalParticipantProperty('raisedHand', raisedHand); + } } }