Skip to content
This repository was archived by the owner on Mar 23, 2024. It is now read-only.

Commit 631a00a

Browse files
committed
Fix determineClosestSupportedResolution
The formula used to find the nearest resolution is a bit broken. Port of: fyhertz/pull/87/commits/5334d8209777cd42407a7960664db7119694a795
1 parent 899ccfe commit 631a00a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/net/majorkernelpanic/streaming/video/VideoQuality.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public static VideoQuality determineClosestSupportedResolution(Camera.Parameters
110110
for (Iterator<Size> it = supportedSizes.iterator(); it.hasNext();) {
111111
Size size = it.next();
112112
supportedSizesStr += size.width+"x"+size.height+(it.hasNext()?", ":"");
113-
int dist = Math.abs(quality.resX - size.width);
113+
int dist = Math.abs(quality.resX - size.width) + Math.abs(quality.resY - size.height);
114114
if (dist<minDist) {
115115
minDist = dist;
116116
v.resX = size.width;

0 commit comments

Comments
 (0)