Make tests mandatory for running Limelight

This commit is contained in:
Iwan Timmer
2014-02-18 17:47:59 +01:00
parent 25562f2831
commit 7921aa8ecb

View File

@@ -47,16 +47,26 @@ public class Limelight implements NvConnectionListener {
/* /*
* Creates a connection to the host and starts up the stream. * Creates a connection to the host and starts up the stream.
*/ */
private void startUp(StreamConfiguration streamConfig, List<String> inputs, String mappingFile, String audioDevice) { private void startUp(StreamConfiguration streamConfig, List<String> inputs, String mappingFile, String audioDevice, boolean tests) {
String vm = System.getProperties().getProperty("java.vm.name"); if (tests) {
if (!vm.contains("HotSpot")) { boolean test = true;
System.err.println("You are using a unsupported VM: " + vm); String vm = System.getProperties().getProperty("java.vm.name");
System.err.println("Please update to Oracle Java (Embedded) for better performances"); if (!vm.contains("HotSpot")) {
} System.err.println("You are using a unsupported VM: " + vm);
String display = System.getenv("DISPLAY"); System.err.println("Please update to Oracle Java (Embedded) for better performances");
if (display!=null) { test = false;
System.err.println("X server is propably running"); }
System.err.println("Please exit the X server for a lower latency"); String display = System.getenv("DISPLAY");
if (display!=null) {
System.err.println("X server is propably running");
System.err.println("Please exit the X server for a lower latency");
test = false;
}
if (!test) {
System.err.println("Fix problems or start application with parameter -notest");
return;
}
} }
conn = new NvConnection(host, this, streamConfig); conn = new NvConnection(host, this, streamConfig);
@@ -171,6 +181,7 @@ public class Limelight implements NvConnectionListener {
int refresh = 60; int refresh = 60;
boolean parse = true; boolean parse = true;
boolean fake = false; boolean fake = false;
boolean tests = true;
String mapping = null; String mapping = null;
String audio = "hw:0,0"; String audio = "hw:0,0";
Level debug = Level.SEVERE; Level debug = Level.SEVERE;
@@ -212,6 +223,8 @@ public class Limelight implements NvConnectionListener {
refresh = 60; refresh = 60;
} else if (args[i].equals("-fake")) { } else if (args[i].equals("-fake")) {
fake = true; fake = true;
} else if (args[i].equals("-notest")) {
tests = false;
} else if (args[i].equals("-v")) { } else if (args[i].equals("-v")) {
debug = Level.WARNING; debug = Level.WARNING;
} else if (args[i].equals("-vv")) { } else if (args[i].equals("-vv")) {
@@ -249,7 +262,7 @@ public class Limelight implements NvConnectionListener {
if (fake) if (fake)
limelight.startUpFake(streamConfig); limelight.startUpFake(streamConfig);
else else
limelight.startUp(streamConfig, inputs, mapping, audio); limelight.startUp(streamConfig, inputs, mapping, audio, tests);
else else
limelight.pair(); limelight.pair();
} }