Tweak on-screen overlay a bit

This commit is contained in:
Cameron Gutman 2019-07-10 20:55:01 -07:00
parent 4469013bb5
commit 40a3cc2ecb
4 changed files with 12 additions and 11 deletions

View File

@ -622,6 +622,7 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer {
decoder = "(unknown)"; decoder = "(unknown)";
} }
float decodeTimeMs = (float)lastTwo.decoderTimeMs / lastTwo.totalFramesReceived;
String perfText = context.getString( String perfText = context.getString(
R.string.perf_overlay_text, R.string.perf_overlay_text,
initialWidth + "x" + initialHeight, initialWidth + "x" + initialHeight,
@ -630,8 +631,8 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer {
fps.receivedFps, fps.receivedFps,
fps.renderedFps, fps.renderedFps,
(float)lastTwo.framesLost / lastTwo.totalFrames * 100, (float)lastTwo.framesLost / lastTwo.totalFrames * 100,
(float)lastTwo.totalTimeMs / lastTwo.totalFramesReceived, ((float)lastTwo.totalTimeMs / lastTwo.totalFramesReceived) - decodeTimeMs,
(float)lastTwo.decoderTimeMs / lastTwo.totalFramesReceived); decodeTimeMs);
perfListener.onPerfUpdate(perfText); perfListener.onPerfUpdate(perfText);
} }

View File

@ -14,19 +14,22 @@
android:id="@+id/performanceOverlay" android:id="@+id/performanceOverlay"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="3dp" android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_gravity="left" android:layout_gravity="left"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="@dimen/font_size_tiny"
android:gravity="left" android:gravity="left"
android:background="#80000000"
android:visibility="gone" /> android:visibility="gone" />
<TextView <TextView
android:id="@+id/notificationOverlay" android:id="@+id/notificationOverlay"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="10dp" android:layout_marginRight="10dp"
android:layout_marginStart="10dp" android:layout_marginEnd="10dp"
android:layout_marginTop="10dp"
android:layout_gravity="right" android:layout_gravity="right"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="right" android:gravity="right"

View File

@ -4,7 +4,4 @@
<dimen name="activity_horizontal_margin">16dp</dimen> <dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen> <dimen name="activity_vertical_margin">16dp</dimen>
<!-- General sizes -->
<dimen name="font_size_tiny">8sp</dimen>
</resources> </resources>

View File

@ -86,7 +86,7 @@
<string name="delete_pc_msg">Are you sure you want to delete this PC?</string> <string name="delete_pc_msg">Are you sure you want to delete this PC?</string>
<string name="slow_connection_msg">Slow connection to PC\nReduce your bitrate</string> <string name="slow_connection_msg">Slow connection to PC\nReduce your bitrate</string>
<string name="poor_connection_msg">Poor connection to PC</string> <string name="poor_connection_msg">Poor connection to PC</string>
<string name="perf_overlay_text">Video dimensions: %1$s\nDecoder: %2$s\nEstimated host PC frame rate: %3$.2f FPS\nIncoming frame rate from network: %4$.2f FPS\nRendering frame rate: %5$.2f FPS\nFrames dropped by your network connection: %6$.2f%%\nAverage frame time: %7$.2f ms\nAverage decoding time: %8$.2f ms</string> <string name="perf_overlay_text">Video dimensions: %1$s\nDecoder: %2$s\nEstimated host PC frame rate: %3$.2f FPS\nIncoming frame rate from network: %4$.2f FPS\nRendering frame rate: %5$.2f FPS\nFrames dropped by your network connection: %6$.2f%%\nAverage receive time: %7$.2f ms\nAverage decoding time: %8$.2f ms</string>
<!-- AppList activity --> <!-- AppList activity -->
<string name="applist_connect_msg">Connecting to PC…</string> <string name="applist_connect_msg">Connecting to PC…</string>
@ -187,6 +187,6 @@
<string name="title_enable_hdr">Enable HDR (Experimental)</string> <string name="title_enable_hdr">Enable HDR (Experimental)</string>
<string name="summary_enable_hdr">Stream HDR when the game and PC GPU support it. HDR requires a GTX 1000 series GPU or later.</string> <string name="summary_enable_hdr">Stream HDR when the game and PC GPU support it. HDR requires a GTX 1000 series GPU or later.</string>
<string name="title_enable_perf_overlay">Enable performance overlay</string> <string name="title_enable_perf_overlay">Enable performance overlay</string>
<string name="summary_enable_perf_overlay">Display performance stats overlay</string> <string name="summary_enable_perf_overlay">Display an on-screen overlay with real-time performance information while streaming</string>
</resources> </resources>