Harden reconnect and WakeLock, add live status UI on the overview.
Android CI / build (push) Canceled after 0s
Android CI / build (push) Canceled after 0s
Fixes flaky Hyperion reconnects and 1h WakeLock cutoffs, disables verbose DEBUG logging, and shows server/FPS/capture stats plus credit in the main status card. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
063a068620
commit
982702cde1
14 files changed
+460
-76
No files matched your search
@@ -37,7 +37,7 @@ import java.nio.ByteBuffer;
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
public final class HyperionScreenEncoder extends HyperionScreenEncoderBase {
|
||||
private static final String TAG = "HyperionScreenEncoder";
|
||||
private static final boolean DEBUG = true;
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
private static final String MIME_TYPE = MediaFormat.MIMETYPE_VIDEO_AVC;
|
||||
private static final int MAX_CAPTURE_WIDTH = 640;
|
||||
@@ -88,6 +88,7 @@ public final class HyperionScreenEncoder extends HyperionScreenEncoderBase {
|
||||
private int mFpsWindowCount;
|
||||
private int mFramesSent;
|
||||
private int mBlackFrameCount;
|
||||
private volatile float mLastSendFps;
|
||||
|
||||
private AnimationSyncController mAnimationSync;
|
||||
private Preferences mPreferences;
|
||||
@@ -475,16 +476,55 @@ public final class HyperionScreenEncoder extends HyperionScreenEncoderBase {
|
||||
long elapsed = now - mFpsWindowStartMs;
|
||||
if (elapsed >= FPS_LOG_INTERVAL_MS) {
|
||||
float fps = mFpsWindowCount * 1000f / elapsed;
|
||||
Log.i(TAG, "Send-FPS=" + String.format("%.1f", fps)
|
||||
+ " framesSent=" + mFramesSent
|
||||
+ " blackFrames=" + mBlackFrameCount
|
||||
+ " capture=" + mCaptureWidth + "x" + mCaptureHeight
|
||||
+ " output=" + mOutputWidth + "x" + mOutputHeight);
|
||||
mLastSendFps = fps;
|
||||
if (DEBUG) {
|
||||
Log.i(TAG, "Send-FPS=" + String.format("%.1f", fps)
|
||||
+ " framesSent=" + mFramesSent
|
||||
+ " blackFrames=" + mBlackFrameCount
|
||||
+ " capture=" + mCaptureWidth + "x" + mCaptureHeight
|
||||
+ " output=" + mOutputWidth + "x" + mOutputHeight);
|
||||
}
|
||||
mFpsWindowStartMs = now;
|
||||
mFpsWindowCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public float getSendFps() {
|
||||
long elapsed = SystemClock.elapsedRealtime() - mFpsWindowStartMs;
|
||||
if (elapsed >= 500L && mFpsWindowCount > 0) {
|
||||
return mFpsWindowCount * 1000f / elapsed;
|
||||
}
|
||||
return mLastSendFps;
|
||||
}
|
||||
|
||||
public int getFramesSent() {
|
||||
return mFramesSent;
|
||||
}
|
||||
|
||||
public int getBlackFrameCount() {
|
||||
return mBlackFrameCount;
|
||||
}
|
||||
|
||||
public int getCaptureWidth() {
|
||||
return mCaptureWidth;
|
||||
}
|
||||
|
||||
public int getCaptureHeight() {
|
||||
return mCaptureHeight;
|
||||
}
|
||||
|
||||
public int getOutputWidth() {
|
||||
return mOutputWidth;
|
||||
}
|
||||
|
||||
public int getOutputHeight() {
|
||||
return mOutputHeight;
|
||||
}
|
||||
|
||||
public int getTargetFrameRate() {
|
||||
return mFrameRate;
|
||||
}
|
||||
|
||||
private void yuvToRgbDownscale(Image image, byte[] rgb, int outW, int outH) {
|
||||
final Image.Plane[] planes = image.getPlanes();
|
||||
if (planes.length < 3) {
|
||||
|
||||
Reference in new issue
Block a user