mirror of
https://github.com/Genymobile/scrcpy.git
synced 2026-04-11 02:11:44 +08:00
Set MediaCodec KEY_LATENCY to the minimum value
The encoder must output a frame as soon as one frame is queued. Refs <https://developer.android.com/reference/android/media/MediaFormat#KEY_LATENCY> Refs #6238 comment <https://github.com/Genymobile/scrcpy/issues/6238#issuecomment-3828402687> PR #6670 <https://github.com/Genymobile/scrcpy/pull/6670>
This commit is contained in:
parent
1f19ec4aec
commit
90d11810e3
@ -266,6 +266,8 @@ public class SurfaceEncoder implements AsyncProcessor {
|
||||
format.setLong(MediaFormat.KEY_REPEAT_PREVIOUS_FRAME_AFTER, REPEAT_FRAME_DELAY_US); // µs
|
||||
// real-time priority
|
||||
format.setInteger(MediaFormat.KEY_PRIORITY, 0);
|
||||
// output 1 frame as soon as 1 frame is queued
|
||||
format.setInteger(MediaFormat.KEY_LATENCY, 1);
|
||||
if (maxFps > 0) {
|
||||
// The key existed privately before Android 10:
|
||||
// <https://android.googlesource.com/platform/frameworks/base/+/625f0aad9f7a259b6881006ad8710adce57d1384%5E%21/>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user