Add network latency to performance overlay

This commit is contained in:
Cameron Gutman
2021-05-15 16:56:19 -05:00
parent 2ca5182a28
commit e79c12a038
5 changed files with 19 additions and 1 deletions

View File

@@ -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));

View File

@@ -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();
}