소스 검색

[RN] Simplify RTCPeerConnection.setRemoteDescription override

master
Saúl Ibarra Corretgé 7 년 전
부모
커밋
955e0a3382
1개의 변경된 파일8개의 추가작업 그리고 26개의 파일을 삭제
  1. 8
    26
      react/features/base/lib-jitsi-meet/native/RTCPeerConnection.js

+ 8
- 26
react/features/base/lib-jitsi-meet/native/RTCPeerConnection.js 파일 보기

96
     this._onaddstreamQueue.push(Array.from(args));
96
     this._onaddstreamQueue.push(Array.from(args));
97
 };
97
 };
98
 
98
 
99
-_RTCPeerConnection.prototype.setRemoteDescription = function(
100
-        sessionDescription,
101
-        successCallback,
102
-        errorCallback) {
103
-    // If the deprecated callback-based version is used, translate it to the
104
-    // Promise-based version.
105
-    if (typeof successCallback !== 'undefined'
106
-            || typeof errorCallback !== 'undefined') {
107
-        // XXX Returning a Promise is not necessary. But I don't see why it'd
108
-        // hurt (much).
109
-        return (
110
-            _RTCPeerConnection.prototype.setRemoteDescription.call(
111
-                    this,
112
-                    sessionDescription)
113
-                .then(successCallback, errorCallback));
114
-    }
99
+_RTCPeerConnection.prototype.setRemoteDescription = function(description) {
115
 
100
 
116
     return (
101
     return (
117
-        _synthesizeIPv6Addresses(sessionDescription)
102
+        _synthesizeIPv6Addresses(description)
118
             .catch(reason => {
103
             .catch(reason => {
119
                 reason && _LOGE(reason);
104
                 reason && _LOGE(reason);
120
 
105
 
121
-                return sessionDescription;
106
+                return description;
122
             })
107
             })
123
             .then(value => _setRemoteDescription.bind(this)(value)));
108
             .then(value => _setRemoteDescription.bind(this)(value)));
124
 
109
 
139
  * implementation which uses the deprecated, callback-based version to the
124
  * implementation which uses the deprecated, callback-based version to the
140
  * {@code Promise}-based version.
125
  * {@code Promise}-based version.
141
  *
126
  *
142
- * @param {RTCSessionDescription} sessionDescription - The RTCSessionDescription
127
+ * @param {RTCSessionDescription} description - The RTCSessionDescription
143
  * which specifies the configuration of the remote end of the connection.
128
  * which specifies the configuration of the remote end of the connection.
144
  * @private
129
  * @private
145
  * @private
130
  * @private
146
  * @returns {Promise}
131
  * @returns {Promise}
147
  */
132
  */
148
-function _setRemoteDescription(sessionDescription) {
133
+function _setRemoteDescription(description) {
149
     return new Promise((resolve, reject) => {
134
     return new Promise((resolve, reject) => {
150
 
135
 
151
         /* eslint-disable no-invalid-this */
136
         /* eslint-disable no-invalid-this */
154
         // setRemoteDescription calls. I shouldn't be but... anyway.
139
         // setRemoteDescription calls. I shouldn't be but... anyway.
155
         this._onaddstreamQueue = [];
140
         this._onaddstreamQueue = [];
156
 
141
 
157
-        RTCPeerConnection.prototype.setRemoteDescription.call(
158
-            this,
159
-            sessionDescription,
160
-            (...args) => {
142
+        RTCPeerConnection.prototype.setRemoteDescription.call(this, description)
143
+            .then((...args) => {
161
                 let q;
144
                 let q;
162
 
145
 
163
                 try {
146
                 try {
168
                 }
151
                 }
169
 
152
 
170
                 this._invokeQueuedOnaddstream(q);
153
                 this._invokeQueuedOnaddstream(q);
171
-            },
172
-            (...args) => {
154
+            }, (...args) => {
173
                 this._onaddstreamQueue = undefined;
155
                 this._onaddstreamQueue = undefined;
174
 
156
 
175
                 reject(...args);
157
                 reject(...args);

Loading…
취소
저장