Просмотр исходного кода

fix(JingleSessionPC): Fix startMuted cases for p2p unified plan.

Chrome doesn't create a decoder for ssrc in the remote description when there is no local source and the endpoint is offerer. Initiating a renegotiation with the endpoint as a responder fixes this issue. Add a workaround until Chrome fixes this bug.
dev1
Jaya Allamsetty 3 лет назад
Родитель
Сommit
a33f820189
1 измененных файлов: 34 добавлений и 12 удалений
  1. 34
    12
      modules/xmpp/JingleSessionPC.js

+ 34
- 12
modules/xmpp/JingleSessionPC.js Просмотреть файл

1015
             jingleAnswer,
1015
             jingleAnswer,
1016
             () => {
1016
             () => {
1017
                 logger.info(`${this} setAnswer - succeeded`);
1017
                 logger.info(`${this} setAnswer - succeeded`);
1018
+                if (this.usesUnifiedPlan && browser.isChromiumBased()) {
1019
+                    // This hack is needed for Chrome to create a decoder for the ssrcs in the remote SDP when
1020
+                    // the local endpoint is the offerer and starts muted.
1021
+                    const remoteSdp = this.peerconnection.remoteDescription.sdp;
1022
+                    const remoteDescription = new RTCSessionDescription({
1023
+                        type: 'offer',
1024
+                        sdp: remoteSdp
1025
+                    });
1026
+
1027
+                    this._responderRenegotiate(remoteDescription);
1028
+                }
1018
             },
1029
             },
1019
             error => {
1030
             error => {
1020
                 logger.error(`${this} setAnswer failed: `, error);
1031
                 logger.error(`${this} setAnswer failed: `, error);
1762
                     ? this._processRemoteAddSource(addOrRemoveSsrcInfo)
1773
                     ? this._processRemoteAddSource(addOrRemoveSsrcInfo)
1763
                     : this._processRemoteRemoveSource(addOrRemoveSsrcInfo);
1774
                     : this._processRemoteRemoveSource(addOrRemoveSsrcInfo);
1764
 
1775
 
1765
-            this._renegotiate(newRemoteSdp.raw)
1766
-                .then(() => {
1767
-                    const newLocalSdp
1768
-                        = new SDP(this.peerconnection.localDescription.sdp);
1769
-
1770
-                    logger.log(`${this} ${logPrefix} - OK`);
1771
-                    this.notifyMySSRCUpdate(oldLocalSdp, newLocalSdp);
1772
-                    finishedCallback();
1773
-                }, error => {
1774
-                    logger.error(`${this} ${logPrefix} failed:`, error);
1775
-                    finishedCallback(error);
1776
-                });
1776
+            // Add a workaround for a bug in Chrome (unified plan) for p2p connection. When the media direction on
1777
+            // the transceiver goes from "inactive" (both users join muted) to "recvonly" (peer unmutes), the browser
1778
+            // doesn't seem to create a decoder if the signaling state changes from "have-local-offer" to "stable".
1779
+            // Therefore, initiate a responder renegotiate even if the endpoint is the offerer to workaround this issue.
1780
+            // TODO - open a chrome bug and update the comments.
1781
+            const remoteDescription = new RTCSessionDescription({
1782
+                type: 'offer',
1783
+                sdp: newRemoteSdp.raw
1784
+            });
1785
+            const promise = isAdd && this.usesUnifiedPlan && this.isP2P && browser.isChromiumBased()
1786
+                ? this._responderRenegotiate(remoteDescription)
1787
+                : this._renegotiate(newRemoteSdp.raw);
1788
+
1789
+            promise.then(() => {
1790
+                const newLocalSdp = new SDP(this.peerconnection.localDescription.sdp);
1791
+
1792
+                logger.log(`${this} ${logPrefix} - OK`);
1793
+                this.notifyMySSRCUpdate(oldLocalSdp, newLocalSdp);
1794
+                finishedCallback();
1795
+            }, error => {
1796
+                logger.error(`${this} ${logPrefix} failed:`, error);
1797
+                finishedCallback(error);
1798
+            });
1777
         };
1799
         };
1778
 
1800
 
1779
         logger.debug(`${this} Queued ${logPrefix} task`);
1801
         logger.debug(`${this} Queued ${logPrefix} task`);

Загрузка…
Отмена
Сохранить