Set latency only for API >= 26

Contrary to what the previous commit message says, KEY_LATENCY was
introduced in API 26, not 23.
This commit is contained in:
Romain Vimont 2026-03-24 20:55:14 +01:00
parent 72d1aedcaa
commit 89b63f081f

View file

@ -267,6 +267,8 @@ public class SurfaceEncoder implements AsyncProcessor {
if (Build.VERSION.SDK_INT >= AndroidVersions.API_23_ANDROID_6_0) {
// real-time priority
format.setInteger(MediaFormat.KEY_PRIORITY, 0);
}
if (Build.VERSION.SDK_INT >= AndroidVersions.API_26_ANDROID_8_0) {
// output 1 frame as soon as 1 frame is queued
format.setInteger(MediaFormat.KEY_LATENCY, 1);
}