Don't fetch stream resolution if model is offline

This commit is contained in:
0xboobface 2018-11-09 14:30:30 +01:00
parent 8ee3d8b588
commit b447c76dac
1 changed files with 5 additions and 2 deletions

View File

@ -171,12 +171,15 @@ public class BongaCamsModel extends AbstractModel {
return new int[2];
}
try {
if(!isOnline()) {
return new int[2];
}
List<StreamSource> streamSources = getStreamSources();
Collections.sort(streamSources);
StreamSource best = streamSources.get(streamSources.size()-1);
resolution = new int[] {best.width, best.height};
} catch (ExecutionException | IOException | ParseException | PlaylistException e) {
LOG.error("Couldn't determine stream resolution for {}", getName(), e);
} catch (ExecutionException | IOException | ParseException | PlaylistException | InterruptedException e) {
LOG.warn("Couldn't determine stream resolution for {} - {}", getName(), e.getMessage());
}
return resolution;
} else {