浏览代码

fix(xmpp): fix race in p2p set codecs

* fix(RTC): fixed typo in function name

* fix(xmpp): codec renegotiation task needs to be queued

* fixed typos
dev1
Nils Ohlmeier 3 年前
父节点
当前提交
63c3e1f869
没有帐户链接到提交者的电子邮件
共有 2 个文件被更改,包括 24 次插入10 次删除
  1. 2
    2
      modules/RTC/CodecSelection.js
  2. 22
    8
      modules/xmpp/JingleSessionPC.js

+ 2
- 2
modules/RTC/CodecSelection.js 查看文件

@@ -59,7 +59,7 @@ export class CodecSelection {
59 59
             () => this._selectPreferredCodec());
60 60
         this.conference.on(
61 61
             JitsiConferenceEvents._MEDIA_SESSION_STARTED,
62
-            session => this._onMediaSessionStared(session));
62
+            session => this._onMediaSessionStarted(session));
63 63
     }
64 64
 
65 65
     /**
@@ -105,7 +105,7 @@ export class CodecSelection {
105 105
      * @returns {void}
106 106
      * @private
107 107
      */
108
-    _onMediaSessionStared(mediaSession) {
108
+    _onMediaSessionStarted(mediaSession) {
109 109
         const preferredCodec = mediaSession.isP2P ? this.p2pPreferredCodec : this.jvbPreferredCodec;
110 110
         const disabledCodec = this.disabledCodec && this._isCodecSupported(this.disabledCodec)
111 111
             ? this.disabledCodec

+ 22
- 8
modules/xmpp/JingleSessionPC.js 查看文件

@@ -1060,15 +1060,29 @@ export default class JingleSessionPC extends JingleSession {
1060 1060
             () => {
1061 1061
                 logger.info(`${this} setAnswer - succeeded`);
1062 1062
                 if (this.usesUnifiedPlan && browser.isChromiumBased()) {
1063
-                    // This hack is needed for Chrome to create a decoder for the ssrcs in the remote SDP when
1064
-                    // the local endpoint is the offerer and starts muted.
1065
-                    const remoteSdp = this.peerconnection.remoteDescription.sdp;
1066
-                    const remoteDescription = new RTCSessionDescription({
1067
-                        type: 'offer',
1068
-                        sdp: remoteSdp
1069
-                    });
1063
+                    const workFunction = finishedCallback => {
1064
+                        // This hack is needed for Chrome to create a decoder for the ssrcs in the remote SDP when
1065
+                        // the local endpoint is the offerer and starts muted.
1066
+                        const remoteSdp = this.peerconnection.remoteDescription.sdp;
1067
+                        const remoteDescription = new RTCSessionDescription({
1068
+                            type: 'offer',
1069
+                            sdp: remoteSdp
1070
+                        });
1070 1071
 
1071
-                    this._responderRenegotiate(remoteDescription);
1072
+                        return this._responderRenegotiate(remoteDescription)
1073
+                        .then(() => finishedCallback(), error => finishedCallback(error));
1074
+                    };
1075
+
1076
+                    logger.debug(`${this} Queued responderRenegotiate task`);
1077
+                    this.modificationQueue.push(
1078
+                        workFunction,
1079
+                        error => {
1080
+                            if (error) {
1081
+                                logger.error(`${this} failed to renegotiate a decoder for muted endpoint ${error}`);
1082
+                            } else {
1083
+                                logger.debug(`${this} renegotiate a decoder for muted endpoint`);
1084
+                            }
1085
+                        });
1072 1086
                 }
1073 1087
             },
1074 1088
             error => {

正在加载...
取消
保存