Ver código fonte

Update modules/xmpp/SDP.js

Co-Authored-By: Saúl Ibarra Corretgé <s@saghul.net>
dev1
Jaya Allamsetty 5 anos atrás
pai
commit
b012353d68

+ 31
- 24
modules/RTC/TPCUtils.js Ver arquivo

@@ -49,18 +49,6 @@ export class TPCUtils {
49 49
         ];
50 50
     }
51 51
 
52
-    /**
53
-     * Obtains local tracks for given {@link MediaType}.
54
-     * @param {MediaType} mediaType - audio or video.
55
-     * @return {Array<JitsiLocalTrack>} - array containing the local tracks
56
-     * attached to the peerconnection of the given media type.
57
-     */
58
-    _getLocalTracks(mediaType) {
59
-        const tracks = Array.from(this.pc.localTracks.values());
60
-
61
-        return tracks.filter(track => track.getType() === mediaType);
62
-    }
63
-
64 52
     /**
65 53
      * Obtains stream encodings that need to be configured on the given track.
66 54
      * @param {JitsiLocalTrack} localTrack
@@ -301,16 +289,23 @@ export class TPCUtils {
301 289
     }
302 290
 
303 291
     /**
304
-     *
305
-     * @param {boolean} active
306
-     */
292
+    * Enables/disables audio transmission on the peer connection. When
293
+    * disabled the audio transceiver direction will be set to 'inactive'
294
+    * which means that no data will be sent nor accepted, but
295
+    * the connection should be kept alive.
296
+    * @param {boolean} active - true to enable audio media transmission or
297
+    * false to disable.
298
+    * @returns {false} - returns false always so that renegotiation is not automatically
299
+    * triggered after this operation.
300
+    */
307 301
     setAudioTransferActive(active) {
308 302
         return this.setMediaTransferActive('audio', active);
309 303
     }
310 304
 
311 305
     /**
312 306
      * Set the simulcast stream encoding properties on the RTCRtpSender.
313
-     * @param {*} track - the current track in use for which the encodings are to be set.
307
+     * @param {JitsiLocalTrack} track - the current track in use for which
308
+     * the encodings are to be set.
314 309
      */
315 310
     setEncodings(track) {
316 311
         const transceiver = this.pc.peerconnection.getTransceivers()
@@ -322,17 +317,23 @@ export class TPCUtils {
322 317
     }
323 318
 
324 319
     /**
325
-     *
326
-     * @param {*} mediaType
327
-     * @param {boolean} active
320
+     * Enables/disables media transmission on the peerconnection by changing the direction
321
+     * on the transceiver for the specified media type.
322
+     * @param {String} mediaType - 'audio' or 'video'
323
+     * @param {boolean} active - true to enable media transmission or false
324
+     * to disable.
325
+     * @returns {false} - returns false always so that renegotiation is not automatically
326
+     * triggered after this operation
328 327
      */
329 328
     setMediaTransferActive(mediaType, active) {
330 329
         const transceivers = this.pc.peerconnection.getTransceivers()
331 330
             .filter(t => t.receiver && t.receiver.track && t.receiver.track.kind === mediaType);
331
+        const localTracks = Array.from(this.pc.localTracks.values())
332
+            .filter(track => track.getType() === mediaType);
332 333
 
333 334
         if (active) {
334 335
             transceivers.forEach(transceiver => {
335
-                if (this._getLocalTracks(mediaType).length > 0) {
336
+                if (localTracks.length) {
336 337
                     transceiver.direction = 'sendrecv';
337 338
                     const parameters = transceiver.sender.getParameters();
338 339
 
@@ -352,13 +353,19 @@ export class TPCUtils {
352 353
             });
353 354
         }
354 355
 
355
-        return true;
356
+        return false;
356 357
     }
357 358
 
358 359
     /**
359
-     *
360
-     * @param {boolean} active
361
-     */
360
+    * Enables/disables video media transmission on the peer connection. When
361
+    * disabled the SDP video media direction in the local SDP will be adjusted to
362
+    * 'inactive' which means that no data will be sent nor accepted, but
363
+    * the connection should be kept alive.
364
+    * @param {boolean} active - true to enable video media transmission or
365
+    * false to disable.
366
+    * @returns {false} - returns false always so that renegotiation is not automatically
367
+    * triggered after this operation.
368
+    */
362 369
     setVideoTransferActive(active) {
363 370
         return this.setMediaTransferActive('video', active);
364 371
     }

+ 1
- 1
modules/browser/BrowserCapabilities.js Ver arquivo

@@ -279,7 +279,7 @@ export default class BrowserCapabilities extends BrowserDetection {
279 279
      * @returns {boolean}
280 280
      */
281 281
     usesAdapter() {
282
-        return !this.isFirefox() && !this.isReactNative();
282
+        return this.usesNewGumFlow();
283 283
     }
284 284
 
285 285
     /**

+ 3
- 5
modules/xmpp/JingleSessionPC.js Ver arquivo

@@ -521,7 +521,7 @@ export default class JingleSessionPC extends JingleSession {
521 521
             const remoteDescription = this.peerconnection.remoteDescription;
522 522
 
523 523
             this.room.eventEmitter.emit(XMPPEvents.PEERCONNECTION_READY, this);
524
-            if (browser.usesUnifiedPlan() && state.toString() === 'stable'
524
+            if (browser.usesUnifiedPlan() && state === 'stable'
525 525
                 && remoteDescription && typeof remoteDescription.sdp === 'string') {
526 526
                 logger.debug(`onnegotiationneeded fired on ${this.peerconnection} in state: ${state}`);
527 527
                 const workFunction = finishedCallback => {
@@ -533,10 +533,8 @@ export default class JingleSessionPC extends JingleSession {
533 533
 
534 534
                             this.notifyMySSRCUpdate(oldSdp, newSdp);
535 535
                             finishedCallback();
536
-                        })
537
-                        .catch(() => {
538
-                            finishedCallback();
539
-                        });
536
+                        },
537
+                        finishedCallback /* will be called with en error */);
540 538
                 };
541 539
 
542 540
                 this.modificationQueue.push(

+ 1
- 1
modules/xmpp/SDP.js Ver arquivo

@@ -570,7 +570,7 @@ SDP.prototype.rtcpFbFromJingle = function(elem, payloadtype) { // XEP-0293
570 570
 // construct an SDP from a jingle stanza
571 571
 SDP.prototype.fromJingle = function(jingle) {
572 572
     const self = this;
573
-    const sessionId = (new Date()).getTime();
573
+    const sessionId = Date.now();
574 574
 
575 575
     // Use a unique session id for every TPC.
576 576
     this.raw = 'v=0\r\n'

Carregando…
Cancelar
Salvar