mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-04-05 23:46:04 +00:00
Add network latency to performance overlay
This commit is contained in:
@@ -656,6 +656,7 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer {
|
||||
}
|
||||
|
||||
float decodeTimeMs = (float)lastTwo.decoderTimeMs / lastTwo.totalFramesReceived;
|
||||
long rttInfo = MoonBridge.getEstimatedRttInfo();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(context.getString(R.string.perf_overlay_dimensions, initialWidth + "x" + initialHeight)).append('\n');
|
||||
sb.append(context.getString(R.string.perf_overlay_decoder, decoder)).append('\n');
|
||||
@@ -664,6 +665,8 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer {
|
||||
sb.append(context.getString(R.string.perf_overlay_renderingfps, fps.renderedFps)).append('\n');
|
||||
sb.append(context.getString(R.string.perf_overlay_netdrops,
|
||||
(float)lastTwo.framesLost / lastTwo.totalFrames * 100)).append('\n');
|
||||
sb.append(context.getString(R.string.perf_overlay_netlatency,
|
||||
(rttInfo >> 32) & 0xFFFF, rttInfo & 0xFFFF)).append('\n');
|
||||
sb.append(context.getString(R.string.perf_overlay_recvtime,
|
||||
((float)lastTwo.totalTimeMs / lastTwo.totalFramesReceived) - decodeTimeMs)).append('\n');
|
||||
sb.append(context.getString(R.string.perf_overlay_dectime, decodeTimeMs));
|
||||
|
||||
@@ -306,5 +306,8 @@ public class MoonBridge {
|
||||
|
||||
public static native String stringifyPortFlags(int portFlags, String separator);
|
||||
|
||||
// The RTT is in the top 32 bits, and the RTT variance is in the bottom 32 bits
|
||||
public static native long getEstimatedRttInfo();
|
||||
|
||||
public static native void init();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user