Explorar el Código

fix(TPC) Disable media instead of changing dir for p2p->jvb switch. (#2226)

* fix(TPC) Disable media instead of changing dir for p2p->jvb switch.
Resume or suspend the media on the jvb peerconnection by changing the RTCRtpEncodingParamters.active state instead of changing the direction on the transceiver. This avoids the needs to start a O/A renegotiation cycle for these operations. The media direction will be changed only for p2p lastn=0 case since video needs to be disabled on both the sender and the peer for p2p lastn=0 case.

* Address review comments

* Disable media after adding source while media is suspended on the jvb connection. Default 'active' state for stream encodings after the source is added is 'true'.

* Wait for all the promises to be settled before returning
master
Jaya Allamsetty hace 2 años
padre
commit
0b9ab37cfe
No account linked to committer's email address

+ 15
- 25
JitsiConference.js Ver fichero

@@ -1632,17 +1632,14 @@ JitsiConference.prototype.setLastN = function(lastN) {
1632 1632
     }
1633 1633
     this.receiveVideoController.setLastN(n);
1634 1634
 
1635
-    // If the P2P session is not fully established yet, we wait until it gets
1636
-    // established.
1635
+    // If the P2P session is not fully established yet, we wait until it gets established.
1637 1636
     if (this.p2pJingleSession) {
1638 1637
         const isVideoActive = n !== 0;
1639 1638
 
1640 1639
         this.p2pJingleSession
1641
-            .setMediaTransferActive(true, isVideoActive)
1640
+            .setP2pVideoTransferActive(isVideoActive)
1642 1641
             .catch(error => {
1643
-                logger.error(
1644
-                    `Failed to adjust video transfer status (${isVideoActive})`,
1645
-                    error);
1642
+                logger.error(`Failed to adjust video transfer status (${isVideoActive})`, error);
1646 1643
             });
1647 1644
     }
1648 1645
 };
@@ -3299,14 +3296,12 @@ JitsiConference.prototype._removeRemoteTracks = function(sessionNickname, remote
3299 3296
  */
3300 3297
 JitsiConference.prototype._resumeMediaTransferForJvbConnection = function() {
3301 3298
     logger.info('Resuming media transfer over the JVB connection...');
3302
-    this.jvbJingleSession.setMediaTransferActive(true, true).then(
3303
-        () => {
3299
+    this.jvbJingleSession.setMediaTransferActive(true)
3300
+        .then(() => {
3304 3301
             logger.info('Resumed media transfer over the JVB connection!');
3305
-        },
3306
-        error => {
3307
-            logger.error(
3308
-                'Failed to resume media transfer over the JVB connection:',
3309
-                error);
3302
+        })
3303
+        .catch(error => {
3304
+            logger.error('Failed to resume media transfer over the JVB connection:', error);
3310 3305
         });
3311 3306
 };
3312 3307
 
@@ -3338,12 +3333,9 @@ JitsiConference.prototype._setP2PStatus = function(newStatus) {
3338 3333
         // when the lastN value was being adjusted.
3339 3334
         const isVideoActive = this.getLastN() !== 0;
3340 3335
 
3341
-        this.p2pJingleSession
3342
-            .setMediaTransferActive(true, isVideoActive)
3336
+        this.p2pJingleSession.setP2pVideoTransferActive(isVideoActive)
3343 3337
             .catch(error => {
3344
-                logger.error(
3345
-                    'Failed to sync up P2P video transfer status'
3346
-                        + `(${isVideoActive})`, error);
3338
+                logger.error(`Failed to sync up P2P video transfer status (${isVideoActive}), ${error}`);
3347 3339
             });
3348 3340
     } else {
3349 3341
         logger.info('Peer to peer connection closed!');
@@ -3428,14 +3420,12 @@ JitsiConference.prototype._startP2PSession = function(remoteJid) {
3428 3420
  */
3429 3421
 JitsiConference.prototype._suspendMediaTransferForJvbConnection = function() {
3430 3422
     logger.info('Suspending media transfer over the JVB connection...');
3431
-    this.jvbJingleSession.setMediaTransferActive(false, false).then(
3432
-        () => {
3423
+    this.jvbJingleSession.setMediaTransferActive(false)
3424
+        .then(() => {
3433 3425
             logger.info('Suspended media transfer over the JVB connection !');
3434
-        },
3435
-        error => {
3436
-            logger.error(
3437
-                'Failed to suspend media transfer over the JVB connection:',
3438
-                error);
3426
+        })
3427
+        .catch(error => {
3428
+            logger.error('Failed to suspend media transfer over the JVB connection:', error);
3439 3429
         });
3440 3430
 };
3441 3431
 

+ 88
- 47
modules/RTC/TPCUtils.js Ver fichero

@@ -61,10 +61,10 @@ export class TPCUtils {
61 61
 
62 62
         return localTrack.isVideoTrack()
63 63
             ? [ {
64
-                active: true,
64
+                active: this.pc.videoTransferActive,
65 65
                 maxBitrate: this.videoBitrates.high
66 66
             } ]
67
-            : [ { active: true } ];
67
+            : [ { active: this.pc.audioTransferActive } ];
68 68
     }
69 69
 
70 70
     /**
@@ -88,19 +88,19 @@ export class TPCUtils {
88 88
 
89 89
         return [
90 90
             {
91
-                active: true,
91
+                active: this.pc.videoTransferActive,
92 92
                 maxBitrate: browser.isFirefox() ? maxVideoBitrate : this.encodingBitrates.low,
93 93
                 rid: SIM_LAYER_1_RID,
94 94
                 scaleResolutionDownBy: browser.isFirefox() ? HD_SCALE_FACTOR : LD_SCALE_FACTOR
95 95
             },
96 96
             {
97
-                active: true,
97
+                active: this.pc.videoTransferActive,
98 98
                 maxBitrate: this.encodingBitrates.standard,
99 99
                 rid: SIM_LAYER_2_RID,
100 100
                 scaleResolutionDownBy: SD_SCALE_FACTOR
101 101
             },
102 102
             {
103
-                active: true,
103
+                active: this.pc.videoTransferActive,
104 104
                 maxBitrate: browser.isFirefox() ? this.encodingBitrates.low : maxVideoBitrate,
105 105
                 rid: SIM_LAYER_3_RID,
106 106
                 scaleResolutionDownBy: browser.isFirefox() ? LD_SCALE_FACTOR : HD_SCALE_FACTOR
@@ -352,6 +352,36 @@ export class TPCUtils {
352 352
         return encodingsBitrates;
353 353
     }
354 354
 
355
+    /**
356
+     * Returns the max resolution that the client is configured to encode for a given local video track. The actual
357
+     * send resolution might be downscaled based on cpu and bandwidth constraints.
358
+     *
359
+     * @param {JitsiLocalTrack} localVideoTrack - The local video track.
360
+     * @returns {number} The max encoded resolution for the given video track.
361
+     */
362
+    getConfiguredEncodeResolution(localVideoTrack) {
363
+        const localTrack = localVideoTrack.getTrack();
364
+        const { height } = localTrack.getSettings();
365
+        const videoSender = this.pc.findSenderForTrack(localVideoTrack.getTrack());
366
+        let maxHeight = 0;
367
+
368
+        if (!videoSender) {
369
+            return maxHeight;
370
+        }
371
+        const parameters = videoSender.getParameters();
372
+
373
+        if (!parameters?.encodings?.length) {
374
+            return maxHeight;
375
+        }
376
+        for (const encoding of parameters.encodings) {
377
+            if (encoding.active) {
378
+                maxHeight = Math.max(maxHeight, height / encoding.scaleResolutionDownBy);
379
+            }
380
+        }
381
+
382
+        return maxHeight;
383
+    }
384
+
355 385
     /**
356 386
      * Replaces the existing track on a RTCRtpSender with the given track.
357 387
      *
@@ -419,19 +449,6 @@ export class TPCUtils {
419 449
             .then(() => Promise.resolve(transceiver));
420 450
     }
421 451
 
422
-    /**
423
-    * Enables/disables audio transmission on the peer connection. When
424
-    * disabled the audio transceiver direction will be set to 'inactive'
425
-    * which means that no data will be sent nor accepted, but
426
-    * the connection should be kept alive.
427
-    * @param {boolean} active - true to enable audio media transmission or
428
-    * false to disable.
429
-    * @returns {void}
430
-    */
431
-    setAudioTransferActive(active) {
432
-        this.setMediaTransferActive(MediaType.AUDIO, active);
433
-    }
434
-
435 452
     /**
436 453
      * Set the simulcast stream encoding properties on the RTCRtpSender.
437 454
      * @param {JitsiLocalTrack} track - the current track in use for which
@@ -455,44 +472,68 @@ export class TPCUtils {
455 472
     }
456 473
 
457 474
     /**
458
-     * Enables/disables media transmission on the peerconnection by changing the direction
459
-     * on the transceiver for the specified media type.
460
-     * @param {String} mediaType - 'audio' or 'video'
461
-     * @param {boolean} active - true to enable media transmission or false
462
-     * to disable.
463
-     * @returns {void}
475
+     * Resumes or suspends media on the peerconnection by setting the active state on RTCRtpEncodingParameters
476
+     * associated with all the senders that have a track attached to it.
477
+     *
478
+     * @param {boolean} enable - whether media needs to be enabled or suspended.
479
+     * @returns {Promise} - A promise that is resolved when the change is succesful on all the senders, rejected
480
+     * otherwise.
464 481
      */
465
-    setMediaTransferActive(mediaType, active) {
466
-        const transceivers = this.pc.peerconnection.getTransceivers()
467
-            .filter(t => t.receiver && t.receiver.track && t.receiver.track.kind === mediaType);
482
+    setMediaTransferActive(enable) {
483
+        logger.info(`${this.pc} ${enable ? 'Resuming' : 'Suspending'} media transfer.`);
468 484
 
469
-        logger.info(`${this.pc} ${active ? 'Enabling' : 'Suspending'} ${mediaType} media transfer.`);
470
-        transceivers.forEach(transceiver => {
471
-            if (active) {
472
-                const localTrackMids = Array.from(this.pc._localTrackTransceiverMids);
485
+        const senders = this.pc.peerconnection.getSenders().filter(s => Boolean(s.track));
486
+        const promises = [];
473 487
 
474
-                if (localTrackMids.find(mids => mids[1] === transceiver.mid)) {
475
-                    transceiver.direction = MediaDirection.SENDRECV;
476
-                } else {
477
-                    transceiver.direction = MediaDirection.RECVONLY;
488
+        for (const sender of senders) {
489
+            const parameters = sender.getParameters();
490
+
491
+            if (parameters?.encodings?.length) {
492
+                for (const encoding of parameters.encodings) {
493
+                    encoding.active = enable;
478 494
                 }
479
-            } else {
480
-                transceiver.direction = MediaDirection.INACTIVE;
481 495
             }
482
-        });
496
+            promises.push(sender.setParameters(parameters));
497
+        }
498
+
499
+        return Promise.allSettled(promises)
500
+            .then(settledResult => {
501
+                const errors = settledResult
502
+                    .filter(result => result.status === 'rejected')
503
+                    .map(result => result.reason);
504
+
505
+                if (errors.length) {
506
+                    return Promise.reject(new Error('Failed to change encodings on the RTCRtpSenders'
507
+                        + `${errors.join(' ')}`));
508
+                }
509
+
510
+                return Promise.resolve();
511
+            });
483 512
     }
484 513
 
485 514
     /**
486
-    * Enables/disables video media transmission on the peer connection. When
487
-    * disabled the SDP video media direction in the local SDP will be adjusted to
488
-    * 'inactive' which means that no data will be sent nor accepted, but
489
-    * the connection should be kept alive.
490
-    * @param {boolean} active - true to enable video media transmission or
491
-    * false to disable.
492
-    * @returns {void}
493
-    */
515
+     * Enables/disables video media transmission on the peer connection. When disabled the SDP video media direction in
516
+     * the local SDP will be adjusted to 'inactive' which means that no data will be sent nor accepted, but the
517
+     * connection should be kept alive. This is used for setting lastn=0 on p2p connection.
518
+     *
519
+     * @param {boolean} active - true to enable media transmission or false to disable.
520
+     * @returns {void}
521
+     */
494 522
     setVideoTransferActive(active) {
495
-        this.setMediaTransferActive(MediaType.VIDEO, active);
523
+        const transceivers = this.pc.peerconnection.getTransceivers()
524
+            .filter(t => t.receiver && t.receiver.track && t.receiver.track.kind === MediaType.VIDEO);
525
+
526
+        logger.info(`${this.pc} ${active ? 'Enabling' : 'Suspending'} video media transfer.`);
527
+        transceivers.forEach(transceiver => {
528
+            const localTrackMids = Array.from(this.pc._localTrackTransceiverMids);
529
+            const direction = active
530
+                ? localTrackMids.find(mids => mids[1] === transceiver.mid)
531
+                    ? MediaDirection.SENDRECV : MediaDirection.RECVONLY
532
+                : MediaDirection.INACTIVE;
533
+
534
+            logger.debug(`Setting direction to ${direction} on mid=${transceiver.mid}`);
535
+            transceiver.direction = direction;
536
+        });
496 537
     }
497 538
 
498 539
     /**

+ 17
- 43
modules/RTC/TraceablePeerConnection.js Ver fichero

@@ -2001,7 +2001,6 @@ TraceablePeerConnection.prototype.replaceTrack = function(oldTrack, newTrack) {
2001 2001
 
2002 2002
     if (this._usesUnifiedPlan) {
2003 2003
         logger.debug(`${this} TPC.replaceTrack using unified plan`);
2004
-        const mediaType = newTrack?.getType() ?? oldTrack?.getType();
2005 2004
 
2006 2005
         return this.tpcUtils.replaceTrack(oldTrack, newTrack)
2007 2006
             .then(transceiver => {
@@ -2030,14 +2029,8 @@ TraceablePeerConnection.prototype.replaceTrack = function(oldTrack, newTrack) {
2030 2029
                         this.localSSRCs.set(newTrack.rtcId, oldTrackSSRC);
2031 2030
                     }
2032 2031
                 }
2033
-                const mediaActive = mediaType === MediaType.AUDIO
2034
-                    ? this.audioTransferActive
2035
-                    : this.videoTransferActive;
2036
-
2037
-                // Set the transceiver direction only if media is not suspended on the connection. This happens when
2038
-                // the client is using the p2p connection. Transceiver direction is updated when media is resumed on
2039
-                // this connection again.
2040
-                if (transceiver && mediaActive) {
2032
+
2033
+                if (transceiver) {
2041 2034
                     // In the scenario where we remove the oldTrack (oldTrack is not null and newTrack is null) on FF
2042 2035
                     // if we change the direction to RECVONLY, create answer will generate SDP with only 1 receive
2043 2036
                     // only ssrc instead of keeping all 6 ssrcs that we currently have. Stopping the screen sharing
@@ -2053,8 +2046,6 @@ TraceablePeerConnection.prototype.replaceTrack = function(oldTrack, newTrack) {
2053 2046
                     // RECVONLY if FF still sends the media even though the enabled flag is set to false.
2054 2047
                     transceiver.direction
2055 2048
                         = newTrack || browser.isFirefox() ? MediaDirection.SENDRECV : MediaDirection.RECVONLY;
2056
-                } else if (transceiver) {
2057
-                    transceiver.direction = MediaDirection.INACTIVE;
2058 2049
                 }
2059 2050
 
2060 2051
                 // Avoid configuring the encodings on Chromium/Safari until simulcast is configured
@@ -2431,6 +2422,13 @@ TraceablePeerConnection.prototype._setVp9MaxBitrates = function(description, isL
2431 2422
  * @returns {Promise} promise that will be resolved when the operation is successful and rejected otherwise.
2432 2423
  */
2433 2424
 TraceablePeerConnection.prototype.configureSenderVideoEncodings = function(localVideoTrack = null) {
2425
+    // If media is suspended on the peerconnection, make sure that media stays disabled. The default 'active' state for
2426
+    // the encodings after the source is added to the peerconnection is 'true', so it needs to be explicitly disabled
2427
+    // after the source is added.
2428
+    if (!(this.videoTransferActive && this.audioTransferActive)) {
2429
+        return this.tpcUtils.setMediaTransferActive(false);
2430
+    }
2431
+
2434 2432
     if (localVideoTrack) {
2435 2433
         return this.setSenderVideoConstraints(
2436 2434
             this._senderMaxHeights.get(localVideoTrack.getSourceName()),
@@ -2486,35 +2484,6 @@ TraceablePeerConnection.prototype.setLocalDescription = function(description) {
2486 2484
     });
2487 2485
 };
2488 2486
 
2489
-/**
2490
- * Enables/disables audio media transmission on this peer connection. When
2491
- * disabled the SDP audio media direction in the local SDP will be adjusted to
2492
- * 'inactive' which means that no data will be sent nor accepted, but
2493
- * the connection should be kept alive.
2494
- * @param {boolean} active <tt>true</tt> to enable audio media transmission or
2495
- * <tt>false</tt> to disable. If the value is not a boolean the call will have
2496
- * no effect.
2497
- * @return {boolean} <tt>true</tt> if the value has changed and sRD/sLD cycle
2498
- * needs to be executed in order for the changes to take effect or
2499
- * <tt>false</tt> if the given value was the same as the previous one.
2500
- * @public
2501
- */
2502
-TraceablePeerConnection.prototype.setAudioTransferActive = function(active) {
2503
-    logger.debug(`${this} audio transfer active: ${active}`);
2504
-    const changed = this.audioTransferActive !== active;
2505
-
2506
-    this.audioTransferActive = active;
2507
-
2508
-    if (this._usesUnifiedPlan) {
2509
-        this.tpcUtils.setAudioTransferActive(active);
2510
-
2511
-        // false means no renegotiation up the chain which is not needed in the Unified mode
2512
-        return false;
2513
-    }
2514
-
2515
-    return changed;
2516
-};
2517
-
2518 2487
 TraceablePeerConnection.prototype.setRemoteDescription = function(description) {
2519 2488
     let remoteDescription = description;
2520 2489
 
@@ -2588,13 +2557,16 @@ TraceablePeerConnection.prototype.setSenderVideoConstraints = function(frameHeig
2588 2557
     if (frameHeight < 0) {
2589 2558
         throw new Error(`Invalid frameHeight: ${frameHeight}`);
2590 2559
     }
2591
-
2592 2560
     const sourceName = localVideoTrack.getSourceName();
2593 2561
 
2594
-    if (this._senderMaxHeights.get(sourceName) === frameHeight) {
2562
+    this._senderMaxHeights.set(sourceName, frameHeight);
2563
+
2564
+    // Ignore sender constraints for the following cases -
2565
+    // 1. If the media on the peerconnection is suspended (jvb conn when p2p is currently active).
2566
+    // 2. If the client is already sending video of the requested resolution.
2567
+    if (!this.videoTransferActive || this.tpcUtils.getConfiguredEncodeResolution(localVideoTrack) === frameHeight) {
2595 2568
         return Promise.resolve();
2596 2569
     }
2597
-    this._senderMaxHeights.set(sourceName, frameHeight);
2598 2570
 
2599 2571
     if (!localVideoTrack || localVideoTrack.isMuted()) {
2600 2572
         return Promise.resolve();
@@ -2668,6 +2640,8 @@ TraceablePeerConnection.prototype.setSenderVideoConstraints = function(frameHeig
2668 2640
                     .find(layer => layer.scaleResolutionDownBy === scaleFactor)?.maxBitrate ?? bitrate;
2669 2641
             }
2670 2642
             parameters.encodings[0].maxBitrate = bitrate;
2643
+        } else {
2644
+            parameters.encodings[0].maxBitrate = undefined;
2671 2645
         }
2672 2646
     } else {
2673 2647
         parameters.encodings[0].active = false;

+ 39
- 53
modules/xmpp/JingleSessionPC.js Ver fichero

@@ -2277,6 +2277,20 @@ export default class JingleSessionPC extends JingleSession {
2277 2277
         });
2278 2278
     }
2279 2279
 
2280
+    /**
2281
+     * Resumes or suspends media transfer over the underlying peer connection.
2282
+     *
2283
+     * @param {boolean} active - <tt>true</tt> to enable media transfer or <tt>false</tt> to suspend media transmission
2284
+     * @returns {Promise}
2285
+     */
2286
+    setMediaTransferActive(active) {
2287
+        return this.peerconnection.tpcUtils.setMediaTransferActive(active)
2288
+            .then(() => {
2289
+                this.peerconnection.audioTransferActive = active;
2290
+                this.peerconnection.videoTransferActive = active;
2291
+            });
2292
+    }
2293
+
2280 2294
     /**
2281 2295
      * Replaces <tt>oldTrack</tt> with <tt>newTrack</tt> and performs a single
2282 2296
      * offer/answer cycle after both operations are done. Either
@@ -2598,68 +2612,39 @@ export default class JingleSessionPC extends JingleSession {
2598 2612
     }
2599 2613
 
2600 2614
     /**
2601
-     * Resumes or suspends media transfer over the underlying peer connection.
2602
-     * @param {boolean} audioActive <tt>true</tt> to enable audio media
2603
-     * transfer or <tt>false</tt> to suspend audio media transmission.
2604
-     * @param {boolean} videoActive <tt>true</tt> to enable video media
2605
-     * transfer or <tt>false</tt> to suspend video media transmission.
2606
-     * @return {Promise} a <tt>Promise</tt> which will resolve once
2607
-     * the operation is done. It will be rejected with an error description as
2608
-     * a string in case anything goes wrong.
2615
+     * Resumes or suspends video media transfer over the p2p peer connection.
2616
+     *
2617
+     * @param {boolean} videoActive <tt>true</tt> to enable video media transfer or <tt>false</tt> to suspend video
2618
+     * media transmission.
2619
+     * @return {Promise} a <tt>Promise</tt> which will resolve once the operation is done. It will be rejected with
2620
+     * an error description as a string in case anything goes wrong.
2609 2621
      */
2610
-    setMediaTransferActive(audioActive, videoActive) {
2622
+    setP2pVideoTransferActive(videoActive) {
2611 2623
         if (!this.peerconnection) {
2612
-            return Promise.reject(
2613
-                'Can not modify transfer active state,'
2624
+            return Promise.reject('Can not modify video transfer active state,'
2614 2625
                     + ' before "initialize" is called');
2615 2626
         }
2616 2627
 
2617
-        const logAudioStr = audioActive ? 'audio active' : 'audio inactive';
2618 2628
         const logVideoStr = videoActive ? 'video active' : 'video inactive';
2619 2629
 
2620
-        logger.info(`${this} Queued make ${logVideoStr}, ${logAudioStr} task`);
2630
+        logger.info(`${this} Queued make ${logVideoStr} task`);
2621 2631
 
2622 2632
         const workFunction = finishedCallback => {
2623 2633
             const isSessionActive = this.state === JingleSessionState.ACTIVE;
2624 2634
 
2625
-            // Because the value is modified on the queue it's impossible to
2626
-            // check it's final value reliably prior to submitting the task.
2627
-            // The rule here is that the last submitted state counts.
2628
-            // Check the values here to avoid unnecessary renegotiation cycle.
2629
-            const audioActiveChanged
2630
-                = this.peerconnection.setAudioTransferActive(audioActive);
2631
-
2632 2635
             if (this._localVideoActive !== videoActive) {
2633 2636
                 this._localVideoActive = videoActive;
2634
-
2635
-                // Do only for P2P - Jicofo will reply with 'bad-request'
2636
-                // We don't want to send 'content-modify', before the initial
2637
-                // O/A (state === JingleSessionState.ACTIVE), because that will
2638
-                // mess up video media direction in the remote SDP.
2639
-                // 'content-modify' when processed only affects the media
2640
-                // direction in the local SDP. We're doing that, because setting
2641
-                // 'inactive' on video media in remote SDP will mess up our SDP
2642
-                // translation chain (simulcast, RTX, video mute etc.).
2643 2637
                 if (this.isP2P && isSessionActive) {
2644 2638
                     this.sendContentModify();
2645 2639
                 }
2646 2640
             }
2647 2641
 
2648
-            const pcVideoActiveChanged
2649
-                = this.peerconnection.setVideoTransferActive(
2650
-                    this._localVideoActive && this._remoteVideoActive);
2642
+            this.peerconnection.setVideoTransferActive(this._localVideoActive && this._remoteVideoActive);
2651 2643
 
2652
-            // Will do the sRD/sLD cycle to update SDPs and adjust the media
2653
-            // direction
2654
-            if (isSessionActive
2655
-                    && (audioActiveChanged || pcVideoActiveChanged)) {
2656
-                this._renegotiate()
2657
-                    .then(
2658
-                        finishedCallback,
2659
-                        finishedCallback /* will be called with an error */);
2660
-            } else {
2661
-                finishedCallback();
2662
-            }
2644
+            // Always initiate a renegotiation cycle for p2p connection when the media direction is changed.
2645
+            this._renegotiate()
2646
+                .then(() => finishedCallback())
2647
+                .catch(error => finishedCallback(error));
2663 2648
         };
2664 2649
 
2665 2650
         return new Promise((resolve, reject) => {
@@ -2667,10 +2652,10 @@ export default class JingleSessionPC extends JingleSession {
2667 2652
                 workFunction,
2668 2653
                 error => {
2669 2654
                     if (error) {
2670
-                        logger.error(`${this} Make ${logVideoStr}, ${logAudioStr} task failed!`);
2655
+                        logger.error(`${this} Make ${logVideoStr} task failed!`);
2671 2656
                         reject(error);
2672 2657
                     } else {
2673
-                        logger.debug(`${this} Make ${logVideoStr}, ${logAudioStr} task done!`);
2658
+                        logger.debug(`${this} Make ${logVideoStr} task done!`);
2674 2659
                         resolve();
2675 2660
                     }
2676 2661
                 });
@@ -2721,13 +2706,12 @@ export default class JingleSessionPC extends JingleSession {
2721 2706
     }
2722 2707
 
2723 2708
     /**
2724
-     * Processes new value of remote video "senders" Jingle attribute and tries
2725
-     * to apply it for {@link _remoteVideoActive}.
2726
-     * @param {string} remoteVideoSenders the value of "senders" attribute of
2727
-     * Jingle video content element advertised by remote peer.
2728
-     * @return {boolean} <tt>true</tt> if the change affected state of
2729
-     * the underlying peerconnection and renegotiation is required for
2730
-     * the changes to take effect.
2709
+     * Processes new value of remote video "senders" Jingle attribute and tries to apply it for
2710
+     * {@link _remoteVideoActive}.
2711
+     * @param {string} remoteVideoSenders the value of "senders" attribute of Jingle video content element advertised
2712
+     * by remote peer.
2713
+     * @return {boolean} <tt>true</tt> if the change affected state of the underlying peerconnection and renegotiation
2714
+     * is required for the changes to take effect.
2731 2715
      * @private
2732 2716
      */
2733 2717
     _modifyRemoteVideoActive(remoteVideoSenders) {
@@ -2739,9 +2723,11 @@ export default class JingleSessionPC extends JingleSession {
2739 2723
         if (isRemoteVideoActive !== this._remoteVideoActive) {
2740 2724
             logger.debug(`${this} new remote video active: ${isRemoteVideoActive}`);
2741 2725
             this._remoteVideoActive = isRemoteVideoActive;
2726
+
2727
+            return this.peerconnection.setVideoTransferActive(this._localVideoActive && this._remoteVideoActive);
2742 2728
         }
2743 2729
 
2744
-        return this.peerconnection.setVideoTransferActive(this._localVideoActive && this._remoteVideoActive);
2730
+        return false;
2745 2731
     }
2746 2732
 
2747 2733
     /**

+ 1
- 2
types/hand-crafted/modules/RTC/TPCUtils.d.ts Ver fichero

@@ -12,9 +12,8 @@ export default class TPCUtils {
12 12
   getLocalStreamHeightConstraints: ( localTrack: JitsiLocalTrack ) => number[];
13 13
   removeTrackMute: ( localTrack: JitsiLocalTrack ) => Promise<void>;
14 14
   replaceTrack: ( oldTrack: JitsiLocalTrack, newTrack: JitsiLocalTrack ) => Promise<void>;
15
-  setAudioTransferActive: ( active: boolean ) => void;
16 15
   setEncodings: ( track: JitsiLocalTrack ) => Promise<void>;
17
-  setMediaTransferActive: ( mediaType: MediaType, active: boolean ) => void;
16
+  setMediaTransferActive: ( active: boolean ) => void;
18 17
   setVideoTransferActive: ( active: boolean ) => void;
19 18
   updateEncodingsResolution: ( parameters: RTCRtpEncodingParameters ) => void;
20 19
 }

+ 0
- 1
types/hand-crafted/modules/RTC/TraceablePeerConnection.d.ts Ver fichero

@@ -103,7 +103,6 @@ export default class TraceablePeerConnection {
103 103
   removeTrackMute: ( localTrack: JitsiLocalTrack ) => Promise<boolean>;
104 104
   createDataChannel: ( label: unknown, opts: unknown ) => unknown; // TODO:
105 105
   setLocalDescription: ( description: unknown ) => Promise<unknown>;
106
-  setAudioTransferActive: ( active: boolean ) => boolean;
107 106
   setSenderVideoDegradationPreference: () => Promise<void>;
108 107
   setMaxBitRate: () => Promise<void>; // TODO: definite bug in the JSDocs
109 108
   setRemoteDescription: ( description: unknown ) => unknown; // TODO:

+ 1
- 1
types/hand-crafted/modules/xmpp/JingleSessionPC.d.ts Ver fichero

@@ -40,7 +40,7 @@ export default class JingleSessionPC extends JingleSession {
40 40
   replaceTrack: ( oldTrack: JitsiLocalTrack | null, newTrack: JitsiLocalTrack | null ) => Promise<unknown>; // TODO:
41 41
   addTrackAsUnmute: ( track: JitsiLocalTrack ) => Promise<unknown>; // TODO:
42 42
   removeTrackAsMute: ( track: JitsiLocalTrack ) => Promise<unknown>; // TODO:
43
-  setMediaTransferActive: ( audioActive: boolean, videoActive: boolean ) => Promise<unknown>; // TODO:
43
+  setMediaTransferActive: ( videoActive: boolean ) => Promise<unknown>; // TODO:
44 44
   modifyContents: ( jingleContents: JQuery ) => void;
45 45
   notifyMySSRCUpdate: ( oldSDP: unknown, newSDP: unknown ) => void; // TODO:
46 46
   newJingleErrorHandler: ( request: unknown, failureCb: ( error: Error ) => void ) => ( this: JingleSessionPC ) => unknown; // TODO:

Loading…
Cancelar
Guardar