瀏覽代碼

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

Configure the encodings on FF after the track is added.
dev1
Jaya Allamsetty 5 年之前
父節點
當前提交
837996ef8e
共有 3 個檔案被更改,包括 51 行新增42 行删除
  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 查看文件

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

+ 43
- 37
modules/RTC/TraceablePeerConnection.js 查看文件

1572
 /**
1572
 /**
1573
  * Add {@link JitsiLocalTrack} to this TPC.
1573
  * Add {@link JitsiLocalTrack} to this TPC.
1574
  * @param {JitsiLocalTrack} track
1574
  * @param {JitsiLocalTrack} track
1575
+ * @param {boolean} isInitiator indicates if the endpoint is the offerer.
1575
  * @returns {Promise<void>} - resolved when done.
1576
  * @returns {Promise<void>} - resolved when done.
1576
  */
1577
  */
1577
 TraceablePeerConnection.prototype.addTrack = function(track, isInitiator = false) {
1578
 TraceablePeerConnection.prototype.addTrack = function(track, isInitiator = false) {
1585
     }
1586
     }
1586
 
1587
 
1587
     this.localTracks.set(rtcId, track);
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 查看文件

945
             const addTracks = [];
945
             const addTracks = [];
946
 
946
 
947
             for (const localTrack of localTracks) {
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
             Promise.all(addTracks)
951
             Promise.all(addTracks)
1044
             const addTracks = [];
1044
             const addTracks = [];
1045
 
1045
 
1046
             for (const track of localTracks) {
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
             const newRemoteSdp
1050
             const newRemoteSdp

Loading…
取消
儲存