|
|
@@ -1,5 +1,7 @@
|
|
1
|
1
|
// @flow
|
|
2
|
2
|
|
|
|
3
|
+import debounce from 'lodash/debounce';
|
|
|
4
|
+
|
|
3
|
5
|
import {
|
|
4
|
6
|
VIDEO_QUALITY_LEVELS,
|
|
5
|
7
|
setMaxReceiverVideoQuality
|
|
|
@@ -44,11 +46,12 @@ StateListenerRegistry.register(
|
|
44
|
46
|
|
|
45
|
47
|
/**
|
|
46
|
48
|
* For auto-pin mode, listen for changes to the known media tracks and look
|
|
47
|
|
- * for updates to screen shares.
|
|
|
49
|
+ * for updates to screen shares. The listener is debounced to avoid state
|
|
|
50
|
+ * thrashing that might occur, especially when switching in or out of p2p.
|
|
48
|
51
|
*/
|
|
49
|
52
|
StateListenerRegistry.register(
|
|
50
|
53
|
/* selector */ state => state['features/base/tracks'],
|
|
51
|
|
- /* listener */ (tracks, store) => {
|
|
|
54
|
+ /* listener */ debounce((tracks, store) => {
|
|
52
|
55
|
if (!AUTO_PIN_LATEST_SCREEN_SHARE) {
|
|
53
|
56
|
return;
|
|
54
|
57
|
}
|
|
|
@@ -88,8 +91,7 @@ StateListenerRegistry.register(
|
|
88
|
91
|
|
|
89
|
92
|
_updateAutoPinnedParticipant(store);
|
|
90
|
93
|
}
|
|
91
|
|
- }
|
|
92
|
|
-);
|
|
|
94
|
+ }, 100));
|
|
93
|
95
|
|
|
94
|
96
|
/**
|
|
95
|
97
|
* Private helper to automatically pin the latest screen share stream or unpin
|