Sort by height only if the height is set

If the height is not available, it is set to Integer.MAX_VALUE. IT makes
not sense to compare by that value. Instead compare the bitrates.
This commit is contained in:
0xboobface 2018-11-26 00:13:53 +01:00
parent 6ee39cb6f4
commit 91ea7d65a3
1 changed files with 1 additions and 1 deletions

View File

@ -54,7 +54,7 @@ public class StreamSource implements Comparable<StreamSource> {
@Override
public int compareTo(StreamSource o) {
int heightDiff = height - o.height;
if(heightDiff != 0) {
if(heightDiff != 0 && height != Integer.MAX_VALUE && o.height != Integer.MAX_VALUE) {
return heightDiff;
} else {
return bandwidth - o.bandwidth;