Sfoglia il codice sorgente

Set FPS constraints only when video has been requested

dev1
Domenic Murtari 9 anni fa
parent
commit
7d0325fe9d
1 ha cambiato i file con 12 aggiunte e 16 eliminazioni
  1. 12
    16
      modules/RTC/RTCUtils.js

+ 12
- 16
modules/RTC/RTCUtils.js Vedi File

172
             });
172
             });
173
         }
173
         }
174
 
174
 
175
+        if (options.minFps || options.maxFps || options.fps) {
176
+            // for some cameras it might be necessary to request 30fps
177
+            // so they choose 30fps mjpg over 10fps yuy2
178
+            if (options.minFps || options.fps) {
179
+                options.minFps = options.minFps || options.fps; //Fall back to options.fps for backwards compatibility
180
+                constraints.video.mandatory.minFrameRate = options.minFps;
181
+            }
182
+            if (options.maxFps) {
183
+                constraints.video.mandatory.maxFrameRate = options.maxFps;
184
+            }
185
+        }
186
+
175
         constraints.video.optional.push({ googLeakyBucket: true });
187
         constraints.video.optional.push({ googLeakyBucket: true });
176
 
188
 
177
         setResolutionConstraints(constraints, options.resolution);
189
         setResolutionConstraints(constraints, options.resolution);
273
         constraints.video.optional.push({bandwidth: options.bandwidth});
285
         constraints.video.optional.push({bandwidth: options.bandwidth});
274
     }
286
     }
275
 
287
 
276
-    if(options.minFps || options.maxFps || options.fps) {
277
-        // for some cameras it might be necessary to request 30fps
278
-        // so they choose 30fps mjpg over 10fps yuy2
279
-        if (!constraints.video) {
280
-            // same behaviour as true;
281
-            constraints.video = {mandatory: {}, optional: []};
282
-        }
283
-        if(options.minFps || options.fps) {
284
-            options.minFps = options.minFps || options.fps; //Fall back to options.fps for backwards compatibility
285
-            constraints.video.mandatory.minFrameRate = options.minFps;
286
-        }
287
-        if(options.maxFps) {
288
-            constraints.video.mandatory.maxFrameRate = options.maxFps;
289
-        }
290
-    }
291
-
292
     // we turn audio for both audio and video tracks, the fake audio & video seems to work
288
     // we turn audio for both audio and video tracks, the fake audio & video seems to work
293
     // only when enabled in one getUserMedia call, we cannot get fake audio separate by fake video
289
     // only when enabled in one getUserMedia call, we cannot get fake audio separate by fake video
294
     // this later can be a problem with some of the tests
290
     // this later can be a problem with some of the tests

Loading…
Annulla
Salva