Преглед на файлове

add local properties for pushing codec type to presence

dev1
Jaya Allamsetty преди 4 години
родител
ревизия
e5faca4a99
променени са 6 файла, в които са добавени 27 реда и са изтрити 65 реда
  1. 3
    1
      JitsiConference.js
  2. 18
    1
      modules/RTC/CodecSelection.js
  3. 0
    8
      modules/RTC/MockClasses.js
  4. 1
    35
      modules/xmpp/ChatRoom.js
  5. 5
    14
      modules/xmpp/JingleSessionPC.js
  6. 0
    6
      modules/xmpp/MockClasses.js

+ 3
- 1
JitsiConference.js Целия файл

@@ -332,7 +332,6 @@ JitsiConference.prototype._init = function(options = {}) {
332 332
     this.room = this.xmpp.createRoom(
333 333
         this.options.name, {
334 334
             ...config,
335
-            preferredCodec: this.codecSelection.getPreferredCodec(),
336 335
             statsId: this._statsCurrentId
337 336
         },
338 337
         JitsiConference.resourceCreator
@@ -503,6 +502,9 @@ JitsiConference.prototype._init = function(options = {}) {
503 502
         this.setLocalParticipantProperty(
504 503
             'region', config.deploymentInfo.userRegion);
505 504
     }
505
+
506
+    // Publish the codec type to presence.
507
+    this.setLocalParticipantProperty('codecType', this.codecSelection.getPreferredCodec());
506 508
 };
507 509
 
508 510
 /**

+ 18
- 1
modules/RTC/CodecSelection.js Целия файл

@@ -115,8 +115,25 @@ export class CodecSelection {
115 115
         const disabledCodec = this.disabledCodec && this._isCodecSupported(this.disabledCodec)
116 116
             ? this.disabledCodec
117 117
             : null;
118
+        let codec = preferredCodec;
118 119
 
119
-        mediaSession.setVideoCodecs(preferredCodec, disabledCodec);
120
+        // For a new endpoint joining the call, JitsiConferenceEvents.USER_JOINED event is received before the
121
+        // media session is created, the supported codecs for all the remote endpoints in the call need to be
122
+        // compared here before setting the codec on the peerconnection.
123
+        if (!mediaSession.isP2P) {
124
+            const remoteParticipants = this.conference.getParticipants().map(participant => participant.getId());
125
+
126
+            for (const remote of remoteParticipants) {
127
+                const peerMediaInfo = mediaSession.signalingLayer.getPeerMediaInfo(remote, MediaType.VIDEO);
128
+
129
+                if (peerMediaInfo && peerMediaInfo.codecType && peerMediaInfo.codecType !== preferredCodec) {
130
+                    this.nonPreferredParticipants.push(remote);
131
+                    codec = peerMediaInfo.codecType;
132
+                }
133
+            }
134
+        }
135
+
136
+        mediaSession.setVideoCodecs(codec, disabledCodec);
120 137
     }
121 138
 
122 139
     /**

+ 0
- 8
modules/RTC/MockClasses.js Целия файл

@@ -35,14 +35,6 @@ export class MockPeerConnection {
35 35
         return Promise.resolve(/* answer */{});
36 36
     }
37 37
 
38
-    /**
39
-     * {@link TraceablePeerConnection.getConfiguredVideoCodec}.
40
-     *
41
-     * @returns {CodecMimeType}
42
-     */
43
-    getConfiguredVideoCodec() {
44
-        return 'vp8';
45
-    }
46 38
 
47 39
     /**
48 40
      * {@link TraceablePeerConnection.setLocalDescription}.

+ 1
- 35
modules/xmpp/ChatRoom.js Целия файл

@@ -166,9 +166,6 @@ export default class ChatRoom extends Listenable {
166 166
         // here.
167 167
         this.addVideoInfoToPresence(false);
168 168
 
169
-        // Set the default codec.
170
-        this.addCodecInfoToPresence(options.preferredCodec);
171
-
172 169
         if (options.deploymentInfo && options.deploymentInfo.userRegion) {
173 170
             this.presMap.nodes.push({
174 171
                 'tagName': 'region',
@@ -1559,37 +1556,6 @@ export default class ChatRoom extends Listenable {
1559 1556
         this.sendPresence();
1560 1557
     }
1561 1558
 
1562
-    /**
1563
-     * Add the codec key to the presence map.
1564
-     *
1565
-     * @param {string} codec - the mime type of the codec that needs to be
1566
-     * published via presence to other users in the conference.
1567
-     *
1568
-     * @returns {void}
1569
-     */
1570
-    addCodecInfoToPresence(codec) {
1571
-        this.addToPresence(
1572
-            'codecType',
1573
-            {
1574
-                attributes: { 'xmlns': 'http://jitsi.org/jitmeet/codec' },
1575
-                value: codec.toString()
1576
-            });
1577
-    }
1578
-
1579
-    /**
1580
-     * Adds the codec key to presence map and sends the presence info
1581
-     * to the room.
1582
-     *
1583
-     * @param {string} codec - the mime type of the codec that needs to be
1584
-     * published via presence to other users in the conference.
1585
-     *
1586
-     * @returns {void}
1587
-     */
1588
-    sendCodecInfoPresence(codec) {
1589
-        this.addCodecInfoToPresence(codec);
1590
-        this.sendPresence();
1591
-    }
1592
-
1593 1559
     /**
1594 1560
      * Obtains the info about given media advertised in the MUC presence of
1595 1561
      * the participant identified by the given endpoint JID.
@@ -1619,7 +1585,7 @@ export default class ChatRoom extends Listenable {
1619 1585
             mutedNode = filterNodeFromPresenceJSON(pres, 'audiomuted');
1620 1586
         } else if (mediaType === MediaType.VIDEO) {
1621 1587
             mutedNode = filterNodeFromPresenceJSON(pres, 'videomuted');
1622
-            const codecTypeNode = filterNodeFromPresenceJSON(pres, 'codecType');
1588
+            const codecTypeNode = filterNodeFromPresenceJSON(pres, 'jitsi_participant_codecType');
1623 1589
             const videoTypeNode = filterNodeFromPresenceJSON(pres, 'videoType');
1624 1590
 
1625 1591
             if (videoTypeNode.length > 0) {

+ 5
- 14
modules/xmpp/JingleSessionPC.js Целия файл

@@ -1816,20 +1816,11 @@ export default class JingleSessionPC extends JingleSession {
1816 1816
             sdp: remoteSdp
1817 1817
         });
1818 1818
 
1819
-        const promise = this.isInitiator
1820
-            ? this._initiatorRenegotiate(remoteDescription)
1821
-            : this._responderRenegotiate(remoteDescription);
1822
-
1823
-        return promise.then(() => {
1824
-            // Publish the codec info to the other endpoints in the conference if it has changed
1825
-            // as a result of the renegotiation (only on current active session).
1826
-            const codec = this.peerconnection.getConfiguredVideoCodec();
1827
-
1828
-            if (this.currentCodec !== codec && this._localVideoActive) {
1829
-                this.room.sendCodecInfoPresence(codec);
1830
-                this.currentCodec = codec;
1831
-            }
1832
-        });
1819
+        if (this.isInitiator) {
1820
+            return this._initiatorRenegotiate(remoteDescription);
1821
+        }
1822
+
1823
+        return this._responderRenegotiate(remoteDescription);
1833 1824
     }
1834 1825
 
1835 1826
     /**

+ 0
- 6
modules/xmpp/MockClasses.js Целия файл

@@ -13,12 +13,6 @@ export class MockChatRoom {
13 13
      */
14 14
     addPresenceListener() {
15 15
     }
16
-
17
-    /**
18
-     * {@link ChatRoom.sendCodecInfoPresence}.
19
-     */
20
-    sendCodecInfoPresence() {
21
-    }
22 16
 }
23 17
 
24 18
 /**

Loading…
Отказ
Запис