Skip to content

Commit

Permalink
backport video constraints (width|height)(max|min) fix from #419
Browse files Browse the repository at this point in the history
  • Loading branch information
hthetiot committed Oct 26, 2019
1 parent 0a90699 commit 26450c9
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/PluginRTCVideoCaptureController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ class PluginRTCVideoCaptureController : NSObject {
maxAspectRatio = aspectRatioRange.object(forKey: "max") as! Float32


NSLog("PluginRTCVideoCaptureController#findFormatForDevice contraints width:%i/%i, height:%i%i, aspectRatio: %f%i, frameRateRanges:%f/%f", minWidth, maxWidth, minHeight, maxHeight, minAspectRatio, maxAspectRatio, minFrameRate, maxFrameRate);
NSLog("PluginRTCVideoCaptureController#findFormatForDevice contraints width:%i/%i, height:%i/%i, aspectRatio: %f/%f, frameRateRanges:%f/%f", minWidth, maxWidth, minHeight, maxHeight, minAspectRatio, maxAspectRatio, minFrameRate, maxFrameRate);

for format: Any in formats {

Expand All @@ -303,13 +303,10 @@ class PluginRTCVideoCaptureController : NSObject {

// dimension.height and dimension.width Matches
if (
(maxHeight == 0 && minHeight == 0) || (
(maxHeight == 0 || dimension.height >= maxHeight) &&
(minHeight == 0 || dimension.height <= minHeight) &&
(maxWidth == 0 || dimension.width >= maxWidth) &&
(minWidth == 0 || dimension.width <= minWidth)
)
((maxHeight == 0 || dimension.height <= maxHeight) && (minHeight == 0 || dimension.height >= minHeight)) &&
((maxWidth == 0 || dimension.width <= maxWidth) && (minWidth == 0 || dimension.width >= minWidth))
) {
//NSLog("dimension %i/%i", dimension.width, dimension.height);
selectedFormat = devFormat
} else {

Expand Down

0 comments on commit 26450c9

Please sign in to comment.