|
|
@@ -96,29 +96,14 @@ _RTCPeerConnection.prototype._queueOnaddstream = function(...args) {
|
|
96
|
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
|
101
|
return (
|
|
117
|
|
- _synthesizeIPv6Addresses(sessionDescription)
|
|
|
102
|
+ _synthesizeIPv6Addresses(description)
|
|
118
|
103
|
.catch(reason => {
|
|
119
|
104
|
reason && _LOGE(reason);
|
|
120
|
105
|
|
|
121
|
|
- return sessionDescription;
|
|
|
106
|
+ return description;
|
|
122
|
107
|
})
|
|
123
|
108
|
.then(value => _setRemoteDescription.bind(this)(value)));
|
|
124
|
109
|
|
|
|
@@ -139,13 +124,13 @@ function _LOGE(...args) {
|
|
139
|
124
|
* implementation which uses the deprecated, callback-based version to the
|
|
140
|
125
|
* {@code Promise}-based version.
|
|
141
|
126
|
*
|
|
142
|
|
- * @param {RTCSessionDescription} sessionDescription - The RTCSessionDescription
|
|
|
127
|
+ * @param {RTCSessionDescription} description - The RTCSessionDescription
|
|
143
|
128
|
* which specifies the configuration of the remote end of the connection.
|
|
144
|
129
|
* @private
|
|
145
|
130
|
* @private
|
|
146
|
131
|
* @returns {Promise}
|
|
147
|
132
|
*/
|
|
148
|
|
-function _setRemoteDescription(sessionDescription) {
|
|
|
133
|
+function _setRemoteDescription(description) {
|
|
149
|
134
|
return new Promise((resolve, reject) => {
|
|
150
|
135
|
|
|
151
|
136
|
/* eslint-disable no-invalid-this */
|
|
|
@@ -154,10 +139,8 @@ function _setRemoteDescription(sessionDescription) {
|
|
154
|
139
|
// setRemoteDescription calls. I shouldn't be but... anyway.
|
|
155
|
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
|
144
|
let q;
|
|
162
|
145
|
|
|
163
|
146
|
try {
|
|
|
@@ -168,8 +151,7 @@ function _setRemoteDescription(sessionDescription) {
|
|
168
|
151
|
}
|
|
169
|
152
|
|
|
170
|
153
|
this._invokeQueuedOnaddstream(q);
|
|
171
|
|
- },
|
|
172
|
|
- (...args) => {
|
|
|
154
|
+ }, (...args) => {
|
|
173
|
155
|
this._onaddstreamQueue = undefined;
|
|
174
|
156
|
|
|
175
|
157
|
reject(...args);
|