mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-04-11 18:36:17 +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.
|
||||
*/
|
||||
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) {
|
||||
boolean test = true;
|
||||
String vm = System.getProperties().getProperty("java.vm.name");
|
||||
@@ -105,7 +105,7 @@ public class Limelight implements NvConnectionListener {
|
||||
conn.start(PlatformBinding.getDeviceName(), null,
|
||||
VideoDecoderRenderer.FLAG_PREFER_QUALITY,
|
||||
PlatformBinding.getAudioRenderer(audioDevice),
|
||||
PlatformBinding.getVideoDecoderRenderer());
|
||||
PlatformBinding.getVideoDecoderRenderer(debug));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -389,7 +389,7 @@ public class Limelight implements NvConnectionListener {
|
||||
if (action.equals("fake"))
|
||||
limelight.startUpFake(streamConfig, video);
|
||||
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"))
|
||||
limelight.pair();
|
||||
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.video.OmxDecoder;
|
||||
import com.limelight.binding.video.OmxDecoderRenderer;
|
||||
import com.limelight.binding.video.AbstractVideoRenderer;
|
||||
import com.limelight.nvstream.av.audio.AudioRenderer;
|
||||
import com.limelight.nvstream.av.video.VideoDecoderRenderer;
|
||||
import com.limelight.nvstream.http.LimelightCryptoProvider;
|
||||
@@ -26,13 +27,15 @@ public class PlatformBinding {
|
||||
* Gets an instance of a video decoder/renderer.
|
||||
* @return a video decoder and renderer
|
||||
*/
|
||||
public static VideoDecoderRenderer getVideoDecoderRenderer() {
|
||||
public static VideoDecoderRenderer getVideoDecoderRenderer(boolean debug) {
|
||||
AbstractVideoRenderer renderer = null;
|
||||
if (OmxDecoder.load())
|
||||
return new OmxDecoderRenderer();
|
||||
renderer = new OmxDecoderRenderer();
|
||||
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 maxLatency;
|
||||
|
||||
public boolean debug;
|
||||
|
||||
@Override
|
||||
public boolean start(final VideoDepacketizer depacketizer) {
|
||||
last = System.currentTimeMillis();
|
||||
@@ -43,7 +45,7 @@ public abstract class AbstractVideoRenderer implements VideoDecoderRenderer {
|
||||
if (latency>maxLatency)
|
||||
maxLatency = latency;
|
||||
|
||||
if (System.currentTimeMillis()>last+2000) {
|
||||
if (debug && System.currentTimeMillis()>last+2000) {
|
||||
int bitrate = (dataSize/2)/1024;
|
||||
System.out.println("Video " + bitrate + "kB/s " + maxLatency + "ms");
|
||||
maxLatency = 0;
|
||||
|
||||
@@ -18,6 +18,7 @@ public class FakeVideoRenderer extends AbstractVideoRenderer {
|
||||
|
||||
public FakeVideoRenderer(String videoFile) {
|
||||
try {
|
||||
this.debug = true;
|
||||
if (videoFile!=null)
|
||||
out = new FileOutputStream(videoFile);
|
||||
} catch (FileNotFoundException e) {
|
||||
|
||||
Reference in New Issue
Block a user