@@ -253,28 +253,35 @@ - (void)getUserVideo:(NSDictionary *)constraints
253
253
}
254
254
255
255
// TODO(rostopira): refactor to separate function and add support for max
256
+
256
257
self._targetWidth = 1280 ;
257
258
self._targetHeight = 720 ;
258
259
self._targetFps = 30 ;
259
- id widthConstraint = videoConstraints[kRTCMediaConstraintsMinWidth ];
260
- if ([widthConstraint isKindOfClass: [NSString class ]]) {
261
- int possibleWidth = [widthConstraint intValue ];
262
- if (possibleWidth != 0 ) {
263
- self._targetWidth = possibleWidth;
260
+
261
+ id mandatory = videoConstraints[@" mandatory" ];
262
+ // constraints.video.mandatory
263
+ if (mandatory && [mandatory isKindOfClass: [NSDictionary class ]])
264
+ {
265
+ id widthConstraint = mandatory[kRTCMediaConstraintsMinWidth ];
266
+ if ([widthConstraint isKindOfClass: [NSString class ]]) {
267
+ int possibleWidth = [widthConstraint intValue ];
268
+ if (possibleWidth != 0 ) {
269
+ self._targetWidth = possibleWidth;
270
+ }
264
271
}
265
- }
266
- id heightConstraint = videoConstraints[ kRTCMediaConstraintsMinHeight ];
267
- if ( [heightConstraint isKindOfClass: [ NSString class ]]) {
268
- int possibleHeight = [heightConstraint intValue ];
269
- if (possibleHeight != 0 ) {
270
- self. _targetHeight = possibleHeight;
272
+ id heightConstraint = mandatory[ kRTCMediaConstraintsMinHeight ];
273
+ if ([heightConstraint isKindOfClass: [ NSString class ]]) {
274
+ int possibleHeight = [heightConstraint intValue ];
275
+ if ( possibleHeight != 0 ) {
276
+ self. _targetHeight = possibleHeight;
277
+ }
271
278
}
272
- }
273
- id fpsConstraint = videoConstraints[ kRTCMediaConstraintsMinFrameRate ];
274
- if ( [fpsConstraint isKindOfClass: [ NSString class ]]) {
275
- int possibleFps = [fpsConstraint intValue ];
276
- if (possibleFps != 0 ) {
277
- self. _targetFps = possibleFps;
279
+ id fpsConstraint = mandatory[ kRTCMediaConstraintsMinFrameRate ];
280
+ if ([fpsConstraint isKindOfClass: [ NSString class ]]) {
281
+ int possibleFps = [fpsConstraint intValue ];
282
+ if ( possibleFps != 0 ) {
283
+ self. _targetFps = possibleFps;
284
+ }
278
285
}
279
286
}
280
287
0 commit comments