mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-06-17 14:22:00 +00:00
Video bandwith and latency only during debugging
This commit is contained in:
@@ -56,7 +56,7 @@ 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, boolean tests) {
|
private void startUp(StreamConfiguration streamConfig, List<String> inputs, String mappingFile, String audioDevice, boolean tests, boolean debug) {
|
||||||
if (tests) {
|
if (tests) {
|
||||||
boolean test = true;
|
boolean test = true;
|
||||||
String vm = System.getProperties().getProperty("java.vm.name");
|
String vm = System.getProperties().getProperty("java.vm.name");
|
||||||
@@ -105,7 +105,7 @@ public class Limelight implements NvConnectionListener {
|
|||||||
conn.start(PlatformBinding.getDeviceName(), null,
|
conn.start(PlatformBinding.getDeviceName(), null,
|
||||||
VideoDecoderRenderer.FLAG_PREFER_QUALITY,
|
VideoDecoderRenderer.FLAG_PREFER_QUALITY,
|
||||||
PlatformBinding.getAudioRenderer(audioDevice),
|
PlatformBinding.getAudioRenderer(audioDevice),
|
||||||
PlatformBinding.getVideoDecoderRenderer());
|
PlatformBinding.getVideoDecoderRenderer(debug));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -389,7 +389,7 @@ public class Limelight implements NvConnectionListener {
|
|||||||
if (action.equals("fake"))
|
if (action.equals("fake"))
|
||||||
limelight.startUpFake(streamConfig, video);
|
limelight.startUpFake(streamConfig, video);
|
||||||
else
|
else
|
||||||
limelight.startUp(streamConfig, inputs, mapping, audio, tests);
|
limelight.startUp(streamConfig, inputs, mapping, audio, tests, debug.intValue() > Level.WARNING.intValue());
|
||||||
} else if (action.equals("pair"))
|
} else if (action.equals("pair"))
|
||||||
limelight.pair();
|
limelight.pair();
|
||||||
else if (action.equals("list"))
|
else if (action.equals("list"))
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.limelight.binding.video.ImxDecoderRenderer;
|
|||||||
import com.limelight.binding.crypto.PcCryptoProvider;
|
import com.limelight.binding.crypto.PcCryptoProvider;
|
||||||
import com.limelight.binding.video.OmxDecoder;
|
import com.limelight.binding.video.OmxDecoder;
|
||||||
import com.limelight.binding.video.OmxDecoderRenderer;
|
import com.limelight.binding.video.OmxDecoderRenderer;
|
||||||
|
import com.limelight.binding.video.AbstractVideoRenderer;
|
||||||
import com.limelight.nvstream.av.audio.AudioRenderer;
|
import com.limelight.nvstream.av.audio.AudioRenderer;
|
||||||
import com.limelight.nvstream.av.video.VideoDecoderRenderer;
|
import com.limelight.nvstream.av.video.VideoDecoderRenderer;
|
||||||
import com.limelight.nvstream.http.LimelightCryptoProvider;
|
import com.limelight.nvstream.http.LimelightCryptoProvider;
|
||||||
@@ -26,13 +27,15 @@ public class PlatformBinding {
|
|||||||
* Gets an instance of a video decoder/renderer.
|
* Gets an instance of a video decoder/renderer.
|
||||||
* @return a video decoder and renderer
|
* @return a video decoder and renderer
|
||||||
*/
|
*/
|
||||||
public static VideoDecoderRenderer getVideoDecoderRenderer() {
|
public static VideoDecoderRenderer getVideoDecoderRenderer(boolean debug) {
|
||||||
|
AbstractVideoRenderer renderer = null;
|
||||||
if (OmxDecoder.load())
|
if (OmxDecoder.load())
|
||||||
return new OmxDecoderRenderer();
|
renderer = new OmxDecoderRenderer();
|
||||||
else if (ImxDecoder.load())
|
else if (ImxDecoder.load())
|
||||||
return new ImxDecoderRenderer();
|
renderer = new ImxDecoderRenderer();
|
||||||
|
|
||||||
return null;
|
renderer.debug = debug;
|
||||||
|
return renderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ public abstract class AbstractVideoRenderer implements VideoDecoderRenderer {
|
|||||||
private long packets;
|
private long packets;
|
||||||
private long maxLatency;
|
private long maxLatency;
|
||||||
|
|
||||||
|
public boolean debug;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean start(final VideoDepacketizer depacketizer) {
|
public boolean start(final VideoDepacketizer depacketizer) {
|
||||||
last = System.currentTimeMillis();
|
last = System.currentTimeMillis();
|
||||||
@@ -43,7 +45,7 @@ public abstract class AbstractVideoRenderer implements VideoDecoderRenderer {
|
|||||||
if (latency>maxLatency)
|
if (latency>maxLatency)
|
||||||
maxLatency = latency;
|
maxLatency = latency;
|
||||||
|
|
||||||
if (System.currentTimeMillis()>last+2000) {
|
if (debug && System.currentTimeMillis()>last+2000) {
|
||||||
int bitrate = (dataSize/2)/1024;
|
int bitrate = (dataSize/2)/1024;
|
||||||
System.out.println("Video " + bitrate + "kB/s " + maxLatency + "ms");
|
System.out.println("Video " + bitrate + "kB/s " + maxLatency + "ms");
|
||||||
maxLatency = 0;
|
maxLatency = 0;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ public class FakeVideoRenderer extends AbstractVideoRenderer {
|
|||||||
|
|
||||||
public FakeVideoRenderer(String videoFile) {
|
public FakeVideoRenderer(String videoFile) {
|
||||||
try {
|
try {
|
||||||
|
this.debug = true;
|
||||||
if (videoFile!=null)
|
if (videoFile!=null)
|
||||||
out = new FileOutputStream(videoFile);
|
out = new FileOutputStream(videoFile);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user