mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-02-16 10:30:47 +00:00
Update Limelight Common to support new version of GFE 2.1.1
This commit is contained in:
Submodule libs/common updated: c24e8a8134...3dd9a41c72
@@ -15,7 +15,6 @@ import com.limelight.nvstream.http.NvHTTP;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.SocketException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -68,7 +67,7 @@ public class Limelight implements NvConnectionListener {
|
||||
}
|
||||
}
|
||||
|
||||
conn = new NvConnection(host, this, streamConfig, PlatformBinding.getCryptoProvider());
|
||||
conn = new NvConnection(host, "Pi", this, streamConfig, PlatformBinding.getCryptoProvider());
|
||||
|
||||
GamepadMapping mapping = null;
|
||||
if (mappingFile!=null) {
|
||||
@@ -102,7 +101,7 @@ public class Limelight implements NvConnectionListener {
|
||||
* Creates a connection to the host and starts up the stream.
|
||||
*/
|
||||
private void startUpFake(StreamConfiguration streamConfig, String videoFile) {
|
||||
conn = new NvConnection(host, this, streamConfig, PlatformBinding.getCryptoProvider());
|
||||
conn = new NvConnection(host, "Pi", this, streamConfig, PlatformBinding.getCryptoProvider());
|
||||
conn.start(PlatformBinding.getDeviceName(), null,
|
||||
VideoDecoderRenderer.FLAG_PREFER_QUALITY,
|
||||
new FakeAudioRenderer(),
|
||||
@@ -113,24 +112,11 @@ public class Limelight implements NvConnectionListener {
|
||||
* Pair the device with the host
|
||||
*/
|
||||
private void pair() {
|
||||
String macAddress;
|
||||
try {
|
||||
macAddress = NvConnection.getMacAddressString();
|
||||
} catch (SocketException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
if (macAddress == null) {
|
||||
displayError("Pair", "Couldn't find a MAC address");
|
||||
return;
|
||||
}
|
||||
|
||||
NvHTTP httpConn;
|
||||
|
||||
try {
|
||||
httpConn = new NvHTTP(InetAddress.getByName(host),
|
||||
macAddress, PlatformBinding.getDeviceName(), PlatformBinding.getCryptoProvider());
|
||||
"Pi", PlatformBinding.getDeviceName(), PlatformBinding.getCryptoProvider());
|
||||
try {
|
||||
if (httpConn.getPairState() == PairingManager.PairState.PAIRED) {
|
||||
displayError("pair", "Already paired");
|
||||
@@ -171,7 +157,6 @@ public class Limelight implements NvConnectionListener {
|
||||
int height = 720;
|
||||
int refresh = 60;
|
||||
int bitrate = 10000;
|
||||
int packetSize = 1024;
|
||||
boolean parse = true;
|
||||
boolean fake = false;
|
||||
boolean tests = true;
|
||||
@@ -256,19 +241,6 @@ public class Limelight implements NvConnectionListener {
|
||||
System.out.println("Syntax error: bitrate expected after -bitrate");
|
||||
System.exit(3);
|
||||
}
|
||||
} else if (args[i].equals("-packetsize")) {
|
||||
if (i + 1 < args.length) {
|
||||
try {
|
||||
packetSize = Integer.parseInt(args[i+1]);
|
||||
} catch (NumberFormatException e) {
|
||||
System.out.println("Syntax error: packetsize must be a number");
|
||||
System.exit(3);
|
||||
}
|
||||
i++;
|
||||
} else {
|
||||
System.out.println("Syntax error: packetsize expected after -packetsize");
|
||||
System.exit(3);
|
||||
}
|
||||
} else if (args[i].equals("-fake")) {
|
||||
fake = true;
|
||||
} else if (args[i].equals("-out")) {
|
||||
@@ -310,7 +282,6 @@ public class Limelight implements NvConnectionListener {
|
||||
System.out.println("\t-30fps\t\tUse 30fps");
|
||||
System.out.println("\t-60fps\t\tUse 60fps [default]");
|
||||
System.out.println("\t-bitrate <bitrate>\t\tSpecify the bitrate in Kbps");
|
||||
System.out.println("\t-packetsize <size>\t\tSpecify the packetsize in bytes");
|
||||
System.out.println("\t-input <device>\tUse <device> as input. Can be used multiple times");
|
||||
System.out.println("\t\t\t[default uses all devices in /dev/input]");
|
||||
System.out.println("\t-mapping <file>\tUse <file> as gamepad mapping configuration file");
|
||||
@@ -324,7 +295,7 @@ public class Limelight implements NvConnectionListener {
|
||||
//Set debugging level
|
||||
Logger.getLogger(LimeLog.class.getName()).setLevel(debug);
|
||||
|
||||
StreamConfiguration streamConfig = new StreamConfiguration(width, height, refresh, bitrate, packetSize);
|
||||
StreamConfiguration streamConfig = new StreamConfiguration("Steam", width, height, refresh, bitrate);
|
||||
|
||||
Limelight limelight = new Limelight(host);
|
||||
if (!pair)
|
||||
|
||||
@@ -16,10 +16,8 @@ public class AlsaAudioRenderer implements AudioRenderer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void streamInitialized(int channelCount, int sampleRate) {
|
||||
int ret = AlsaAudio.init(channelCount, sampleRate, device);
|
||||
if (ret != 0)
|
||||
throw new IllegalStateException("Alsa renderer initialization failure: "+ret);
|
||||
public boolean streamInitialized(int channelCount, int sampleRate) {
|
||||
return AlsaAudio.init(channelCount, sampleRate, device) == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,9 +12,10 @@ public class FakeAudioRenderer implements AudioRenderer {
|
||||
private long last;
|
||||
|
||||
@Override
|
||||
public void streamInitialized(int channelCount, int sampleRate) {
|
||||
public boolean streamInitialized(int channelCount, int sampleRate) {
|
||||
System.out.println("Fake " + channelCount + " channel " + sampleRate + " samplerate audio output");
|
||||
last = System.currentTimeMillis();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,8 +17,12 @@ public abstract class AbstractVideoRenderer implements VideoDecoderRenderer {
|
||||
private int dataSize;
|
||||
private long last;
|
||||
|
||||
private long endToEndLatency;
|
||||
private long decodeLatency;
|
||||
private long packets;
|
||||
|
||||
@Override
|
||||
public void start(final VideoDepacketizer depacketizer) {
|
||||
public boolean start(final VideoDepacketizer depacketizer) {
|
||||
last = System.currentTimeMillis();
|
||||
thread = new Thread(new Runnable() {
|
||||
@Override
|
||||
@@ -26,14 +30,17 @@ public abstract class AbstractVideoRenderer implements VideoDecoderRenderer {
|
||||
while (running) {
|
||||
try {
|
||||
DecodeUnit decodeUnit = depacketizer.takeNextDecodeUnit();
|
||||
long latency = System.currentTimeMillis()-decodeUnit.getReceiveTimestamp();
|
||||
endToEndLatency += latency;
|
||||
|
||||
dataSize += decodeUnit.getDataLength();
|
||||
decodeUnit(decodeUnit);
|
||||
|
||||
if (System.currentTimeMillis()>last+2000) {
|
||||
int bitrate = (dataSize/2)/1024;
|
||||
long latency = System.currentTimeMillis()-decodeUnit.getReceiveTimestamp();
|
||||
System.out.println("Video " + bitrate + "kB/s " + latency + "ms");
|
||||
latency = System.currentTimeMillis()-decodeUnit.getReceiveTimestamp();
|
||||
decodeLatency += latency;
|
||||
System.out.println("Video " + bitrate + "kB/s " + latency);
|
||||
dataSize = 0;
|
||||
last = System.currentTimeMillis();
|
||||
}
|
||||
@@ -43,6 +50,7 @@ public abstract class AbstractVideoRenderer implements VideoDecoderRenderer {
|
||||
});
|
||||
running = true;
|
||||
thread.start();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -62,5 +70,15 @@ public abstract class AbstractVideoRenderer implements VideoDecoderRenderer {
|
||||
public int getCapabilities() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAverageEndToEndLatency() {
|
||||
return (int) (endToEndLatency / packets);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAverageDecoderLatency() {
|
||||
return (int) (decodeLatency / packets);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,8 +26,9 @@ public class FakeVideoRenderer extends AbstractVideoRenderer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup(int width, int height, int redrawRate, Object renderTarget, int drFlags) {
|
||||
public boolean setup(int width, int height, int redrawRate, Object renderTarget, int drFlags) {
|
||||
System.out.println("Fake " + width + "x" + height + " " + redrawRate + "fps video output");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,10 +14,8 @@ public class OmxDecoderRenderer extends AbstractVideoRenderer {
|
||||
private final static byte[] BITSTREAM_RESTRICTIONS = new byte[] {(byte) 0xF1, (byte) 0x83, 0x2A, 0x00};
|
||||
|
||||
@Override
|
||||
public void setup(int width, int height, int redrawRate, Object renderTarget, int drFlags) {
|
||||
int err = OmxDecoder.init();
|
||||
if (err != 0)
|
||||
throw new IllegalStateException("AVC decoder initialization failure: "+err);
|
||||
public boolean setup(int width, int height, int redrawRate, Object renderTarget, int drFlags) {
|
||||
return OmxDecoder.init() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -132,5 +130,5 @@ public class OmxDecoderRenderer extends AbstractVideoRenderer {
|
||||
source.offset = offset;
|
||||
source.length = length;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user