Przeglądaj źródła

ref(JingleSessionPC) Do not renegotiate on every local source change.

Instead rely on the 'negotiationneeded' event fired by the browser for JVB connection. This makes local source changes faster even if the modification queue is backed up.
tags/v0.0.2
Jaya Allamsetty 4 lat temu
rodzic
commit
012c38769d

+ 7
- 9
modules/RTC/TraceablePeerConnection.js Wyświetl plik

1972
  * <tt>oldTrack</tt> with a null <tt>newTrack</tt> effectively just removes
1972
  * <tt>oldTrack</tt> with a null <tt>newTrack</tt> effectively just removes
1973
  * <tt>oldTrack</tt>
1973
  * <tt>oldTrack</tt>
1974
  *
1974
  *
1975
- * @param {JitsiLocalTrack|null} oldTrack - The current track in use to be
1976
- * replaced
1977
- * @param {JitsiLocalTrack|null} newTrack - The new track to use
1978
- * @returns {Promise<boolean>} - If the promise resolves with true,
1979
- * renegotiation will be needed. Otherwise no renegotiation is needed.
1975
+ * @param {JitsiLocalTrack|null} oldTrack - The current track in use to be replaced on the pc.
1976
+ * @param {JitsiLocalTrack|null} newTrack - The new track to be used.
1977
+ *
1978
+ * @returns {Promise<boolean>} - If the promise resolves with true, renegotiation will be needed.
1979
+ * Otherwise no renegotiation is needed.
1980
  */
1980
  */
1981
 TraceablePeerConnection.prototype.replaceTrack = function(oldTrack, newTrack) {
1981
 TraceablePeerConnection.prototype.replaceTrack = function(oldTrack, newTrack) {
1982
     if (this._usesUnifiedPlan) {
1982
     if (this._usesUnifiedPlan) {
1983
         logger.debug(`${this} TPC.replaceTrack using unified plan`);
1983
         logger.debug(`${this} TPC.replaceTrack using unified plan`);
1984
 
1984
 
1985
-        return this.tpcUtils.replaceTrack(oldTrack, newTrack)
1986
-
1987
-            // Renegotiate when SDP is used for simulcast munging or when in p2p mode.
1988
-            .then(() => (this.isSimulcastOn() && browser.usesSdpMungingForSimulcast()) || this.isP2P);
1985
+        // Renegotiate only in the case of P2P. We rely on 'negotiationeeded' to be fired for JVB.
1986
+        return this.tpcUtils.replaceTrack(oldTrack, newTrack).then(() => this.isP2P);
1989
     }
1987
     }
1990
 
1988
 
1991
     logger.debug(`${this} TPC.replaceTrack using plan B`);
1989
     logger.debug(`${this} TPC.replaceTrack using plan B`);

+ 10
- 6
modules/xmpp/JingleSessionPC.js Wyświetl plik

599
             const state = this.peerconnection.signalingState;
599
             const state = this.peerconnection.signalingState;
600
             const remoteDescription = this.peerconnection.remoteDescription;
600
             const remoteDescription = this.peerconnection.remoteDescription;
601
 
601
 
602
-            if (this.usesUnifiedPlan && state === 'stable'
603
-                && remoteDescription && typeof remoteDescription.sdp === 'string') {
604
-                logger.debug(`${this} onnegotiationneeded fired on ${this.peerconnection} in state: ${state}`);
602
+            if (this.usesUnifiedPlan
603
+                && !this.isP2P
604
+                && state === 'stable'
605
+                && remoteDescription
606
+                && typeof remoteDescription.sdp === 'string') {
607
+                logger.info(`${this} onnegotiationneeded fired on ${this.peerconnection}`);
608
+
605
                 const workFunction = finishedCallback => {
609
                 const workFunction = finishedCallback => {
606
                     const oldSdp = new SDP(this.peerconnection.localDescription.sdp);
610
                     const oldSdp = new SDP(this.peerconnection.localDescription.sdp);
607
 
611
 
608
                     this._renegotiate()
612
                     this._renegotiate()
613
+                        .then(() => this.peerconnection.configureSenderVideoEncodings())
609
                         .then(() => {
614
                         .then(() => {
610
                             const newSdp = new SDP(this.peerconnection.localDescription.sdp);
615
                             const newSdp = new SDP(this.peerconnection.localDescription.sdp);
611
 
616
 
612
                             this.notifyMySSRCUpdate(oldSdp, newSdp);
617
                             this.notifyMySSRCUpdate(oldSdp, newSdp);
613
-                            finishedCallback();
614
-                        },
615
-                        finishedCallback /* will be called with en error */);
618
+                        })
619
+                        .then(() => finishedCallback(), error => finishedCallback(error));
616
                 };
620
                 };
617
 
621
 
618
                 this.modificationQueue.push(
622
                 this.modificationQueue.push(

Ładowanie…
Anuluj
Zapisz