Sfoglia il codice sorgente

fix: getting right resolution for mobile web (#2356)

release-8443
Gabriel Borlea 2 anni fa
parent
commit
c3a086f86d
Nessun account collegato all'indirizzo email del committer

+ 3
- 3
modules/RTC/JitsiLocalTrack.js Vedi File

102
 
102
 
103
         // Get the resolution from the track itself because it cannot be
103
         // Get the resolution from the track itself because it cannot be
104
         // certain which resolution webrtc has fallen back to using.
104
         // certain which resolution webrtc has fallen back to using.
105
-        this.resolution = track.getSettings().height;
105
+        this.resolution = this.getHeight();
106
         this.maxEnabledResolution = resolution;
106
         this.maxEnabledResolution = resolution;
107
 
107
 
108
         // Cache the constraints of the track in case of any this track
108
         // Cache the constraints of the track in case of any this track
112
         // Safari returns an empty constraints object, construct the constraints using getSettings.
112
         // Safari returns an empty constraints object, construct the constraints using getSettings.
113
         if (!Object.keys(this._constraints).length && videoType === VideoType.CAMERA) {
113
         if (!Object.keys(this._constraints).length && videoType === VideoType.CAMERA) {
114
             this._constraints = {
114
             this._constraints = {
115
-                height: track.getSettings().height,
116
-                width: track.getSettings().width
115
+                height: track.getHeight(),
116
+                width: track.getWidth()
117
             };
117
             };
118
         }
118
         }
119
 
119
 

+ 14
- 0
modules/RTC/JitsiTrack.js Vedi File

378
         return this.videoType;
378
         return this.videoType;
379
     }
379
     }
380
 
380
 
381
+    /**
382
+     * Returns the height of the track in normalized landscape format.
383
+     */
384
+    getHeight() {
385
+        return Math.min(this.track.getSettings().height, this.track.getSettings().width);
386
+    }
387
+
388
+    /**
389
+     * Returns the width of the track in normalized landscape format.
390
+     */
391
+    getWidth() {
392
+        return Math.max(this.track.getSettings().height, this.track.getSettings().width);
393
+    }
394
+
381
     /**
395
     /**
382
      * Checks whether the MediaStream is active/not ended.
396
      * Checks whether the MediaStream is active/not ended.
383
      * When there is no check for active we don't have information and so
397
      * When there is no check for active we don't have information and so

+ 2
- 4
modules/RTC/TPCUtils.js Vedi File

307
      * @returns {Array<boolean>}
307
      * @returns {Array<boolean>}
308
      */
308
      */
309
     calculateEncodingsActiveState(localVideoTrack, newHeight) {
309
     calculateEncodingsActiveState(localVideoTrack, newHeight) {
310
-        const localTrack = localVideoTrack.getTrack();
311
-        const { height } = localTrack.getSettings();
310
+        const height = localVideoTrack.getHeight();
312
         const videoStreamEncodings = this._getVideoStreamEncodings(localVideoTrack.getVideoType());
311
         const videoStreamEncodings = this._getVideoStreamEncodings(localVideoTrack.getVideoType());
313
         const encodingsState = videoStreamEncodings
312
         const encodingsState = videoStreamEncodings
314
         .map(encoding => height / encoding.scaleResolutionDownBy)
313
         .map(encoding => height / encoding.scaleResolutionDownBy)
384
      * @returns {number|null} The max encoded resolution for the given video track.
383
      * @returns {number|null} The max encoded resolution for the given video track.
385
      */
384
      */
386
     getConfiguredEncodeResolution(localVideoTrack) {
385
     getConfiguredEncodeResolution(localVideoTrack) {
387
-        const localTrack = localVideoTrack.getTrack();
388
-        const { height } = localTrack.getSettings();
386
+        const height = localVideoTrack.getHeight();
389
         const videoSender = this.pc.findSenderForTrack(localVideoTrack.getTrack());
387
         const videoSender = this.pc.findSenderForTrack(localVideoTrack.getTrack());
390
         let maxHeight = 0;
388
         let maxHeight = 0;
391
 
389
 

+ 1
- 1
modules/RTC/TraceablePeerConnection.js Vedi File

2677
     if ((localVideoTrack.getVideoType() === VideoType.CAMERA && configuredResolution === frameHeight)
2677
     if ((localVideoTrack.getVideoType() === VideoType.CAMERA && configuredResolution === frameHeight)
2678
         || (localVideoTrack.getVideoType() === VideoType.DESKTOP
2678
         || (localVideoTrack.getVideoType() === VideoType.DESKTOP
2679
             && frameHeight > 0
2679
             && frameHeight > 0
2680
-            && configuredResolution === localVideoTrack.getTrack()?.getSettings()?.height)) {
2680
+            && configuredResolution === localVideoTrack.getHeight())) {
2681
         return Promise.resolve();
2681
         return Promise.resolve();
2682
     }
2682
     }
2683
 
2683
 

Loading…
Annulla
Salva