Quellcode durchsuchen

ref(unified-plan): Fix unified plan p2p case.

Configure the encodings on FF after the track is added.
dev1
Jaya Allamsetty vor 5 Jahren
Ursprung
Commit
837996ef8e
3 geänderte Dateien mit 51 neuen und 42 gelöschten Zeilen
  1. 6
    3
      modules/RTC/TPCUtils.js
  2. 43
    37
      modules/RTC/TraceablePeerConnection.js
  3. 2
    2
      modules/xmpp/JingleSessionPC.js

+ 6
- 3
modules/RTC/TPCUtils.js Datei anzeigen

@@ -192,9 +192,11 @@ export class TPCUtils {
192 192
     /**
193 193
     * Adds {@link JitsiLocalTrack} to the WebRTC peerconnection for the first time.
194 194
     * @param {JitsiLocalTrack} track - track to be added to the peerconnection.
195
+    * @param {boolean} isInitiator - boolean that indicates if the endpoint is offerer
196
+    * in a p2p connection.
195 197
     * @returns {void}
196 198
     */
197
-    addTrack(localTrack, isInitiator = true) {
199
+    addTrack(localTrack, isInitiator) {
198 200
         const track = localTrack.getTrack();
199 201
 
200 202
         if (isInitiator) {
@@ -375,7 +377,7 @@ export class TPCUtils {
375 377
     * @returns {void}
376 378
     */
377 379
     setAudioTransferActive(active) {
378
-        this.setMediaTransferActive('audio', active);
380
+        this.setMediaTransferActive(MediaType.AUDIO, active);
379 381
     }
380 382
 
381 383
     /**
@@ -406,6 +408,7 @@ export class TPCUtils {
406 408
         const transceivers = this.pc.peerconnection.getTransceivers()
407 409
             .filter(t => t.receiver && t.receiver.track && t.receiver.track.kind === mediaType);
408 410
         const localTracks = this.pc.getLocalTracks(mediaType);
411
+        logger.info(`${active ? 'Enabling' : 'Suspending'} ${mediaType} media transfer on ${this.pc}`);
409 412
 
410 413
         transceivers.forEach((transceiver, idx) => {
411 414
             if (active) {
@@ -431,6 +434,6 @@ export class TPCUtils {
431 434
     * @returns {void}
432 435
     */
433 436
     setVideoTransferActive(active) {
434
-        this.setMediaTransferActive('video', active);
437
+        this.setMediaTransferActive(MediaType.VIDEO, active);
435 438
     }
436 439
 }

+ 43
- 37
modules/RTC/TraceablePeerConnection.js Datei anzeigen

@@ -1572,6 +1572,7 @@ TraceablePeerConnection.prototype.containsTrack = function(track) {
1572 1572
 /**
1573 1573
  * Add {@link JitsiLocalTrack} to this TPC.
1574 1574
  * @param {JitsiLocalTrack} track
1575
+ * @param {boolean} isInitiator indicates if the endpoint is the offerer.
1575 1576
  * @returns {Promise<void>} - resolved when done.
1576 1577
  */
1577 1578
 TraceablePeerConnection.prototype.addTrack = function(track, isInitiator = false) {
@@ -1585,50 +1586,55 @@ TraceablePeerConnection.prototype.addTrack = function(track, isInitiator = false
1585 1586
     }
1586 1587
 
1587 1588
     this.localTracks.set(rtcId, track);
1588
-    if (browser.usesUnifiedPlan() && isInitiator) {
1589
-        this.tpcUtils.addTrack(track, isInitiator);
1590
-
1591
-        return Promise.resolve();
1592
-    }
1593 1589
 
1594
-    const webrtcStream = track.getOriginalStream();
1595
-
1596
-    if (webrtcStream) {
1597
-        this._addStream(webrtcStream);
1598
-
1599
-    // It's not ok for a track to not have a WebRTC stream if:
1600
-    } else if (!browser.doesVideoMuteByStreamRemove()
1601
-                || track.isAudioTrack()
1602
-                || (track.isVideoTrack() && !track.isMuted())) {
1603
-        return Promise.reject(new Error(`${this} no WebRTC stream for: ${track}`));
1604
-    }
1590
+    // For p2p unified case, use addTransceiver API to add the tracks on the peerconnection.
1591
+    if (browser.usesUnifiedPlan() && this.isP2P) {
1592
+        this.tpcUtils.addTrack(track, isInitiator);
1593
+    } else {
1594
+        // In all other cases, i.e., plan-b and unified plan bridge case, use addStream API to
1595
+        // add the track to the peerconnection.
1596
+        // TODO - addTransceiver doesn't generate a MSID for the stream, which is needed for signaling
1597
+        // the ssrc to Jicofo. Switch to using UUID as MSID when addTransceiver is used in Unified plan
1598
+        // JVB connection case as well.
1599
+        const webrtcStream = track.getOriginalStream();
1600
+
1601
+        if (webrtcStream) {
1602
+            this._addStream(webrtcStream);
1603
+
1604
+        // It's not ok for a track to not have a WebRTC stream if:
1605
+        } else if (!browser.doesVideoMuteByStreamRemove()
1606
+                    || track.isAudioTrack()
1607
+                    || (track.isVideoTrack() && !track.isMuted())) {
1608
+            return Promise.reject(new Error(`${this} no WebRTC stream for: ${track}`));
1609
+        }
1605 1610
 
1606
-    // Muted video tracks do not have WebRTC stream
1607
-    if (browser.usesPlanB() && browser.doesVideoMuteByStreamRemove()
1608
-            && track.isVideoTrack() && track.isMuted()) {
1609
-        const ssrcInfo = this.generateNewStreamSSRCInfo(track);
1611
+        // Muted video tracks do not have WebRTC stream
1612
+        if (browser.usesPlanB() && browser.doesVideoMuteByStreamRemove()
1613
+                && track.isVideoTrack() && track.isMuted()) {
1614
+            const ssrcInfo = this.generateNewStreamSSRCInfo(track);
1610 1615
 
1611
-        this.sdpConsistency.setPrimarySsrc(ssrcInfo.ssrcs[0]);
1612
-        const simGroup
1613
-            = ssrcInfo.groups.find(groupInfo => groupInfo.semantics === 'SIM');
1616
+            this.sdpConsistency.setPrimarySsrc(ssrcInfo.ssrcs[0]);
1617
+            const simGroup
1618
+                = ssrcInfo.groups.find(groupInfo => groupInfo.semantics === 'SIM');
1614 1619
 
1615
-        if (simGroup) {
1616
-            this.simulcast.setSsrcCache(simGroup.ssrcs);
1617
-        }
1618
-        const fidGroups
1619
-            = ssrcInfo.groups.filter(
1620
-                groupInfo => groupInfo.semantics === 'FID');
1620
+            if (simGroup) {
1621
+                this.simulcast.setSsrcCache(simGroup.ssrcs);
1622
+            }
1623
+            const fidGroups
1624
+                = ssrcInfo.groups.filter(
1625
+                    groupInfo => groupInfo.semantics === 'FID');
1621 1626
 
1622
-        if (fidGroups) {
1623
-            const rtxSsrcMapping = new Map();
1627
+            if (fidGroups) {
1628
+                const rtxSsrcMapping = new Map();
1624 1629
 
1625
-            fidGroups.forEach(fidGroup => {
1626
-                const primarySsrc = fidGroup.ssrcs[0];
1627
-                const rtxSsrc = fidGroup.ssrcs[1];
1630
+                fidGroups.forEach(fidGroup => {
1631
+                    const primarySsrc = fidGroup.ssrcs[0];
1632
+                    const rtxSsrc = fidGroup.ssrcs[1];
1628 1633
 
1629
-                rtxSsrcMapping.set(primarySsrc, rtxSsrc);
1630
-            });
1631
-            this.rtxModifier.setSsrcCache(rtxSsrcMapping);
1634
+                    rtxSsrcMapping.set(primarySsrc, rtxSsrc);
1635
+                });
1636
+                this.rtxModifier.setSsrcCache(rtxSsrcMapping);
1637
+            }
1632 1638
         }
1633 1639
     }
1634 1640
 

+ 2
- 2
modules/xmpp/JingleSessionPC.js Datei anzeigen

@@ -945,7 +945,7 @@ export default class JingleSessionPC extends JingleSession {
945 945
             const addTracks = [];
946 946
 
947 947
             for (const localTrack of localTracks) {
948
-                addTracks.push(this.peerconnection.addTrack(localTrack, true /* isInitiator */));
948
+                addTracks.push(this.peerconnection.addTrack(localTrack, this.isInitiator));
949 949
             }
950 950
 
951 951
             Promise.all(addTracks)
@@ -1044,7 +1044,7 @@ export default class JingleSessionPC extends JingleSession {
1044 1044
             const addTracks = [];
1045 1045
 
1046 1046
             for (const track of localTracks) {
1047
-                addTracks.push(this.peerconnection.addTrack(track));
1047
+                addTracks.push(this.peerconnection.addTrack(track, this.isInitiator));
1048 1048
             }
1049 1049
 
1050 1050
             const newRemoteSdp

Laden…
Abbrechen
Speichern