Bläddra i källkod

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 år sedan
förälder
incheckning
d73723dae6
Inget konto är kopplat till bidragsgivarens mejladress
2 ändrade filer med 23 tillägg och 16 borttagningar
  1. 6
    6
      JitsiConference.js
  2. 17
    10
      modules/xmpp/ChatRoom.js

+ 6
- 6
JitsiConference.js Visa fil

1188
         }
1188
         }
1189
     }
1189
     }
1190
     if (newTrack.isVideoTrack()) {
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
     this.rtc.addLocalTrack(newTrack);
1198
     this.rtc.addLocalTrack(newTrack);
1199
 
1199
 

+ 17
- 10
modules/xmpp/ChatRoom.js Visa fil

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
         if (options.deploymentInfo && options.deploymentInfo.userRegion) {
164
         if (options.deploymentInfo && options.deploymentInfo.userRegion) {
170
             this.presMap.nodes.push({
165
             this.presMap.nodes.push({
171
                 'tagName': 'region',
166
                 'tagName': 'region',
1419
      * Adds the key to the presence map, overriding any previous value.
1414
      * Adds the key to the presence map, overriding any previous value.
1420
      * @param key The key to add or replace.
1415
      * @param key The key to add or replace.
1421
      * @param values The new values.
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
      * performed as the value was already there.
1418
      * performed as the value was already there.
1424
      */
1419
      */
1425
     addOrReplaceInPresence(key, values) {
1420
     addOrReplaceInPresence(key, values) {
1562
      * @param mute
1557
      * @param mute
1563
      */
1558
      */
1564
     addAudioInfoToPresence(mute) {
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
         return this.addOrReplaceInPresence(
1567
         return this.addOrReplaceInPresence(
1566
-            'audiomuted',
1568
+            audioMutedTagName,
1567
             {
1569
             {
1568
-                attributes: { 'xmlns': 'http://jitsi.org/jitmeet/audio' },
1569
                 value: mute.toString()
1570
                 value: mute.toString()
1570
             });
1571
             });
1571
     }
1572
     }
1588
      * @param mute
1589
      * @param mute
1589
      */
1590
      */
1590
     addVideoInfoToPresence(mute) {
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
         return this.addOrReplaceInPresence(
1599
         return this.addOrReplaceInPresence(
1592
-            'videomuted',
1600
+            videoMutedTagName,
1593
             {
1601
             {
1594
-                attributes: { 'xmlns': 'http://jitsi.org/jitmeet/video' },
1595
                 value: mute.toString()
1602
                 value: mute.toString()
1596
             });
1603
             });
1597
     }
1604
     }

Laddar…
Avbryt
Spara