-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ABR): Allow some downscale when use restrictToElementSize or restrictToScreenSize #5631
feat(ABR): Allow some downscale when use restrictToElementSize or restrictToScreenSize #5631
Conversation
…trictToScreenSize
Incremental code coverage: 28.21% |
lib/abr/simple_abr_manager.js
Outdated
if (resolution.height >= maxHeight || resolution.width >= maxWidth) { | ||
maxHeight = resolution.height; | ||
maxWidth = resolution.width; | ||
if (resolution.height >= maxHeight && resolution.width >= maxWidth) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand your logic here. On the previous two lines, we set maxHeight and maxWidth to resolution.height and resolution.width, so this condition is always true on this line. Right?
Overall, I would find this easier to review and verify with some comments in the code. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment with an example for explanatory purposes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this code would result in the behavior you explain in the comments, of looking for the smallest resolution that will "fit" the given max resolution. Given that it happens after maxWidth and maxHeight are re-defined, the inner if-condition is really testing resolution.height >= resolution.height && resolution.width >= resolution.width
, which will only be false if the resolution is undefined
, and thus it will cause the first resolution where EITHER width or height fits to be picked.
I think you probably just want to make the inner if-clause the outer check, and make it always break. Like...
if (resolution.height >= maxHeight && resolution.width >= maxWidth) {
maxHeight = resolution.height;
maxWidth = resolution.width;
break;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.. I changed it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes much more sense to me. Thanks!
@avelad hi, in the
But when I switched back to the FYI @theodab @joeyparrish |
Closes: #5335
Closes: #5101