Ver código fonte

Update presence and skip default values (#1536)

* feat: Video type camera is default value of missing, skip it in presence.

We skip sending initial video type camera if it is already missing from presence, if it changes we send the last value.
We also are dropping the namespace as it is not used anywhere and just increases presence size.

* feat: A/V muted is default so we can skip adding it initially to the presence.

Dropping the namespace as it is not used anywhere and that reduces size.

* squash: Drops unused setting.

* squash: Adds a config option to enable skipping the muted state.
dev1
Дамян Минков 4 anos atrás
pai
commit
d73723dae6
Nenhuma conta vinculada ao e-mail do autor do commit
2 arquivos alterados com 23 adições e 16 exclusões
  1. 6
    6
      JitsiConference.js
  2. 17
    10
      modules/xmpp/ChatRoom.js

+ 6
- 6
JitsiConference.js Ver arquivo

@@ -1188,12 +1188,12 @@ JitsiConference.prototype._setupNewTrack = function(newTrack) {
1188 1188
         }
1189 1189
     }
1190 1190
     if (newTrack.isVideoTrack()) {
1191
-        this.sendCommand('videoType', {
1192
-            value: newTrack.videoType,
1193
-            attributes: {
1194
-                xmlns: 'http://jitsi.org/jitmeet/video'
1195
-            }
1196
-        });
1191
+        const videoTypeTagName = 'videoType';
1192
+
1193
+        // if video type is camera and there is no videoType in presence, we skip adding it, as this is the default one
1194
+        if (newTrack.videoType !== VideoType.CAMERA || this.room.getFromPresence(videoTypeTagName)) {
1195
+            this.sendCommand(videoTypeTagName, { value: newTrack.videoType });
1196
+        }
1197 1197
     }
1198 1198
     this.rtc.addLocalTrack(newTrack);
1199 1199
 

+ 17
- 10
modules/xmpp/ChatRoom.js Ver arquivo

@@ -161,11 +161,6 @@ export default class ChatRoom extends Listenable {
161 161
             });
162 162
         }
163 163
 
164
-        // We need to broadcast 'videomuted' status from the beginning, cause
165
-        // Jicofo makes decisions based on that. Initialize it with 'false'
166
-        // here.
167
-        this.addVideoInfoToPresence(false);
168
-
169 164
         if (options.deploymentInfo && options.deploymentInfo.userRegion) {
170 165
             this.presMap.nodes.push({
171 166
                 'tagName': 'region',
@@ -1419,7 +1414,7 @@ export default class ChatRoom extends Listenable {
1419 1414
      * Adds the key to the presence map, overriding any previous value.
1420 1415
      * @param key The key to add or replace.
1421 1416
      * @param values The new values.
1422
-     * @returns {boolean|null} <tt>true</tt> if the operation succeeded or <tt>false</tt> when no add or replce was
1417
+     * @returns {boolean|null} <tt>true</tt> if the operation succeeded or <tt>false</tt> when no add or replace was
1423 1418
      * performed as the value was already there.
1424 1419
      */
1425 1420
     addOrReplaceInPresence(key, values) {
@@ -1562,10 +1557,16 @@ export default class ChatRoom extends Listenable {
1562 1557
      * @param mute
1563 1558
      */
1564 1559
     addAudioInfoToPresence(mute) {
1560
+        const audioMutedTagName = 'audiomuted';
1561
+
1562
+        // we skip adding it as muted is default value
1563
+        if (mute && !this.getFromPresence(audioMutedTagName) && this.options.testing.enableSkipDefaultMutedState) {
1564
+            return false;
1565
+        }
1566
+
1565 1567
         return this.addOrReplaceInPresence(
1566
-            'audiomuted',
1568
+            audioMutedTagName,
1567 1569
             {
1568
-                attributes: { 'xmlns': 'http://jitsi.org/jitmeet/audio' },
1569 1570
                 value: mute.toString()
1570 1571
             });
1571 1572
     }
@@ -1588,10 +1589,16 @@ export default class ChatRoom extends Listenable {
1588 1589
      * @param mute
1589 1590
      */
1590 1591
     addVideoInfoToPresence(mute) {
1592
+        const videoMutedTagName = 'videomuted';
1593
+
1594
+        // we skip adding it as muted is default value
1595
+        if (mute && !this.getFromPresence(videoMutedTagName) && this.options.testing.enableSkipDefaultMutedState) {
1596
+            return false;
1597
+        }
1598
+
1591 1599
         return this.addOrReplaceInPresence(
1592
-            'videomuted',
1600
+            videoMutedTagName,
1593 1601
             {
1594
-                attributes: { 'xmlns': 'http://jitsi.org/jitmeet/video' },
1595 1602
                 value: mute.toString()
1596 1603
             });
1597 1604
     }

Carregando…
Cancelar
Salvar