Browse Source

fix: Skip sending unnecessary signalling for raise hand.

j8
damencho 4 years ago
parent
commit
ec6abc1ce9
1 changed files with 14 additions and 6 deletions
  1. 14
    6
      react/features/base/participants/middleware.js

+ 14
- 6
react/features/base/participants/middleware.js View File

71
         break;
71
         break;
72
 
72
 
73
     case DOMINANT_SPEAKER_CHANGED: {
73
     case DOMINANT_SPEAKER_CHANGED: {
74
-        // Ensure the raised hand state is cleared for the dominant speaker.
74
+        // Ensure the raised hand state is cleared for the dominant speaker
75
+        // and only if it was set when this is the local participant
75
 
76
 
76
         const { conference, id } = action.participant;
77
         const { conference, id } = action.participant;
77
         const participant = getLocalParticipant(store.getState());
78
         const participant = getLocalParticipant(store.getState());
79
+        const isLocal = participant && participant.id === id;
80
+
81
+        if (isLocal && participant.raisedHand === undefined) {
82
+            // if local was undefined, let's leave it like that
83
+            // avoids sending unnecessary presence updates
84
+            break;
85
+        }
78
 
86
 
79
         participant
87
         participant
80
             && store.dispatch(participantUpdated({
88
             && store.dispatch(participantUpdated({
81
                 conference,
89
                 conference,
82
                 id,
90
                 id,
83
-                local: participant.id === id,
91
+                local: isLocal,
84
                 raisedHand: false
92
                 raisedHand: false
85
             }));
93
             }));
86
 
94
 
369
         if (local) {
377
         if (local) {
370
             const { conference } = getState()['features/base/conference'];
378
             const { conference } = getState()['features/base/conference'];
371
 
379
 
372
-            conference
373
-                && conference.setLocalParticipantProperty(
374
-                    'raisedHand',
375
-                    raisedHand);
380
+            // Send raisedHand signalling only if there is a change
381
+            if (conference && raisedHand !== getLocalParticipant(getState()).raisedHand) {
382
+                conference.setLocalParticipantProperty('raisedHand', raisedHand);
383
+            }
376
         }
384
         }
377
     }
385
     }
378
 
386
 

Loading…
Cancel
Save