Commit ded8abef authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Keep ratio when choosing nearest available video resolution.

parent df49b31c
......@@ -162,7 +162,11 @@ public class AndroidVideoApi5JniWrapper {
int req = rW * rH;
int minDist = Integer.MAX_VALUE;
int useDownscale = 0;
int ratioToKeep = (int)(((float)rW / (float)rH) * 100);
for(Size s: supportedSizes) {
int ratio = (int)(((float)s.width / (float)s.height) * 100);
if (ratio != ratioToKeep) continue;
int dist = Math.abs(req - s.width * s.height);
if (dist < minDist) {
minDist = dist;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment