mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-02-16 10:31:07 +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();
|
||||
}
|
||||
|
||||
Submodule app/src/main/jni/moonlight-core/moonlight-common-c updated: 5d09d43b08...edf1838708
@@ -134,4 +134,15 @@ Java_com_limelight_nvstream_jni_MoonBridge_stringifyPortFlags(JNIEnv *env, jclas
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, separator, separatorStr);
|
||||
return (*env)->NewStringUTF(env, outputBuffer);
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_com_limelight_nvstream_jni_MoonBridge_getEstimatedRttInfo(JNIEnv *env, jclass clazz) {
|
||||
uint32_t rtt, variance;
|
||||
|
||||
if (!LiGetEstimatedRttInfo(&rtt, &variance)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ((uint64_t)rtt << 32U) | variance;
|
||||
}
|
||||
@@ -110,6 +110,7 @@
|
||||
<string name="perf_overlay_incomingfps">Incoming frame rate from network: %1$.2f FPS</string>
|
||||
<string name="perf_overlay_renderingfps">Rendering frame rate: %1$.2f FPS</string>
|
||||
<string name="perf_overlay_netdrops">Frames dropped by your network connection: %1$.2f%%</string>
|
||||
<string name="perf_overlay_netlatency">Average network latency: %1$d ms (variance: %2$d ms)</string>
|
||||
<string name="perf_overlay_recvtime">Average receive time: %1$.2f ms</string>
|
||||
<string name="perf_overlay_dectime">Average decoding time: %1$.2f ms</string>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user