Browse Source

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 years ago
parent
commit
304b0a2b4e
No account linked to committer's email address

+ 2
- 0
modules/RTC/JitsiLocalTrack.js View File

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

+ 4
- 1
modules/RTC/TraceablePeerConnection.js View File

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 View File

1
 import * as ConnectionQualityEvents
1
 import * as ConnectionQualityEvents
2
     from '../../service/connectivity/ConnectionQualityEvents';
2
     from '../../service/connectivity/ConnectionQualityEvents';
3
 import * as ConferenceEvents from '../../JitsiConferenceEvents';
3
 import * as ConferenceEvents from '../../JitsiConferenceEvents';
4
+import * as RTCEvents from '../../service/RTC/RTCEvents';
5
+
4
 import { getLogger } from 'jitsi-meet-logger';
6
 import { getLogger } from 'jitsi-meet-logger';
5
 
7
 
6
 const XMPPEvents = require('../../service/xmpp/XMPPEvents');
8
 const XMPPEvents = require('../../service/xmpp/XMPPEvents');
278
                     this._maybeUpdateUnmuteTime();
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
         conference.on(
289
         conference.on(
283
             ConferenceEvents.SERVER_REGION_CHANGED,
290
             ConferenceEvents.SERVER_REGION_CHANGED,
454
             connectionQuality: this._localStats.connectionQuality,
461
             connectionQuality: this._localStats.connectionQuality,
455
             jvbRTT: this._localStats.jvbRTT,
462
             jvbRTT: this._localStats.jvbRTT,
456
             serverRegion: this._localStats.serverRegion,
463
             serverRegion: this._localStats.serverRegion,
464
+            maxEnabledResolution: this._localStats.maxEnabledResolution,
457
             avgAudioLevels: this._localStats.localAvgAudioLevels
465
             avgAudioLevels: this._localStats.localAvgAudioLevels
458
         };
466
         };
459
 
467
 
504
         const videoType
512
         const videoType
505
             = localVideoTrack ? localVideoTrack.videoType : undefined;
513
             = localVideoTrack ? localVideoTrack.videoType : undefined;
506
         const isMuted = localVideoTrack ? localVideoTrack.isMuted() : true;
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
         if (!isMuted) {
518
         if (!isMuted) {
510
             this._maybeUpdateUnmuteTime();
519
             this._maybeUpdateUnmuteTime();
545
             connectionQuality: data.connectionQuality,
554
             connectionQuality: data.connectionQuality,
546
             jvbRTT: data.jvbRTT,
555
             jvbRTT: data.jvbRTT,
547
             serverRegion: data.serverRegion,
556
             serverRegion: data.serverRegion,
557
+            maxEnabledResolution: data.maxEnabledResolution,
548
             avgAudioLevels: data.avgAudioLevels
558
             avgAudioLevels: data.avgAudioLevels
549
         };
559
         };
550
 
560
 

+ 5
- 0
service/RTC/RTCEvents.js View File

37
      */
37
      */
38
     LOCAL_TRACK_SSRC_UPDATED: 'rtc.local_track_ssrc_updated',
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
     TRACK_ATTACHED: 'rtc.track_attached',
45
     TRACK_ATTACHED: 'rtc.track_attached',
41
 
46
 
42
     /**
47
     /**

Loading…
Cancel
Save