Bläddra i källkod

Takes disabled encodings into account when calculating the local resolution. (#1242)

* fix: Takes disabled encodings into account when calculating local resolution.
* feat: Adds a new event that's triggered when the max enabled resolution changes.
* feat: Broadcasts the max enabled resolution value along with other stats.
dev1
George Politis 5 år sedan
förälder
incheckning
304b0a2b4e
Inget konto är kopplat till bidragsgivarens mejladress

+ 2
- 0
modules/RTC/JitsiLocalTrack.js Visa fil

@@ -92,6 +92,7 @@ export default class JitsiLocalTrack extends JitsiTrack {
92 92
             // Get the resolution from the track itself because it cannot be
93 93
             // certain which resolution webrtc has fallen back to using.
94 94
             this.resolution = track.getSettings().height;
95
+            this.maxEnabledResolution = resolution;
95 96
 
96 97
             // Cache the constraints of the track in case of any this track
97 98
             // model needs to call getUserMedia again, such as when unmuting.
@@ -109,6 +110,7 @@ export default class JitsiLocalTrack extends JitsiTrack {
109 110
             // resolutions so we do not store it, to avoid wrong reporting of
110 111
             // local track resolution.
111 112
             this.resolution = browser.isFirefox() ? null : resolution;
113
+            this.maxEnabledResolution = this.resolution;
112 114
         }
113 115
 
114 116
         this.deviceId = deviceId;

+ 4
- 1
modules/RTC/TraceablePeerConnection.js Visa fil

@@ -2131,7 +2131,10 @@ TraceablePeerConnection.prototype.setSenderVideoConstraint = function(frameHeigh
2131 2131
                     }
2132 2132
                 }
2133 2133
 
2134
-                return videoSender.setParameters(parameters);
2134
+                return videoSender.setParameters(parameters).then(() => {
2135
+                    localVideoTrack.maxEnabledResolution = newHeight;
2136
+                    this.eventEmitter.emit(RTCEvents.LOCAL_TRACK_MAX_ENABLED_RESOLUTION_CHANGED, localVideoTrack);
2137
+                });
2135 2138
             });
2136 2139
     }
2137 2140
 

+ 11
- 1
modules/connectivity/ConnectionQuality.js Visa fil

@@ -1,6 +1,8 @@
1 1
 import * as ConnectionQualityEvents
2 2
     from '../../service/connectivity/ConnectionQualityEvents';
3 3
 import * as ConferenceEvents from '../../JitsiConferenceEvents';
4
+import * as RTCEvents from '../../service/RTC/RTCEvents';
5
+
4 6
 import { getLogger } from 'jitsi-meet-logger';
5 7
 
6 8
 const XMPPEvents = require('../../service/xmpp/XMPPEvents');
@@ -278,6 +280,11 @@ export default class ConnectionQuality {
278 280
                     this._maybeUpdateUnmuteTime();
279 281
                 }
280 282
             });
283
+        conference.rtc.on(
284
+            RTCEvents.LOCAL_TRACK_MAX_ENABLED_RESOLUTION_CHANGED,
285
+            track => {
286
+                this._localStats.maxEnabledResolution = track.maxEnabledResolution;
287
+            });
281 288
 
282 289
         conference.on(
283 290
             ConferenceEvents.SERVER_REGION_CHANGED,
@@ -454,6 +461,7 @@ export default class ConnectionQuality {
454 461
             connectionQuality: this._localStats.connectionQuality,
455 462
             jvbRTT: this._localStats.jvbRTT,
456 463
             serverRegion: this._localStats.serverRegion,
464
+            maxEnabledResolution: this._localStats.maxEnabledResolution,
457 465
             avgAudioLevels: this._localStats.localAvgAudioLevels
458 466
         };
459 467
 
@@ -504,7 +512,8 @@ export default class ConnectionQuality {
504 512
         const videoType
505 513
             = localVideoTrack ? localVideoTrack.videoType : undefined;
506 514
         const isMuted = localVideoTrack ? localVideoTrack.isMuted() : true;
507
-        const resolution = localVideoTrack ? localVideoTrack.resolution : null;
515
+        const resolution = localVideoTrack
516
+            ? Math.min(localVideoTrack.resolution, localVideoTrack.maxEnabledResolution) : null;
508 517
 
509 518
         if (!isMuted) {
510 519
             this._maybeUpdateUnmuteTime();
@@ -545,6 +554,7 @@ export default class ConnectionQuality {
545 554
             connectionQuality: data.connectionQuality,
546 555
             jvbRTT: data.jvbRTT,
547 556
             serverRegion: data.serverRegion,
557
+            maxEnabledResolution: data.maxEnabledResolution,
548 558
             avgAudioLevels: data.avgAudioLevels
549 559
         };
550 560
 

+ 5
- 0
service/RTC/RTCEvents.js Visa fil

@@ -37,6 +37,11 @@ const RTCEvents = {
37 37
      */
38 38
     LOCAL_TRACK_SSRC_UPDATED: 'rtc.local_track_ssrc_updated',
39 39
 
40
+    /**
41
+     * The max enabled resolution of a local video track was changed.
42
+     */
43
+    LOCAL_TRACK_MAX_ENABLED_RESOLUTION_CHANGED: 'rtc.local_track_max_enabled_resolution_changed',
44
+
40 45
     TRACK_ATTACHED: 'rtc.track_attached',
41 46
 
42 47
     /**

Laddar…
Avbryt
Spara