Only display the host processing latency if it was present

This commit is contained in:
Cameron Gutman 2023-06-24 15:00:54 -05:00
parent 46f887efec
commit 7f15f45beb

View File

@ -1335,14 +1335,16 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer implements C
sb.append(context.getString(R.string.perf_overlay_decoder, decoder)).append('\n');
sb.append(context.getString(R.string.perf_overlay_incomingfps, fps.receivedFps)).append('\n');
sb.append(context.getString(R.string.perf_overlay_renderingfps, fps.renderedFps)).append('\n');
sb.append(context.getString(R.string.perf_overlay_hostprocessinglatency,
(float)lastTwo.minHostProcessingLatency / 10,
(float)lastTwo.maxHostProcessingLatency / 10,
(float)lastTwo.totalHostProcessingLatency / 10 / Math.max(lastTwo.framesWithHostProcessingLatency, 1))).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,
(int)(rttInfo >> 32), (int)rttInfo)).append('\n');
if (lastTwo.framesWithHostProcessingLatency > 0) {
sb.append(context.getString(R.string.perf_overlay_hostprocessinglatency,
(float)lastTwo.minHostProcessingLatency / 10,
(float)lastTwo.maxHostProcessingLatency / 10,
(float)lastTwo.totalHostProcessingLatency / 10 / lastTwo.framesWithHostProcessingLatency)).append('\n');
}
sb.append(context.getString(R.string.perf_overlay_dectime, decodeTimeMs));
perfListener.onPerfUpdate(sb.toString());
}