Keep Camera2 frames when timestamp jitter crosses nominal frame duration

This commit is contained in:
evgeny committed 2026-10-15 00:49:52 +02:00
1 parent 6ff21c12ef
commit 5c6f71c602
1 file changed
+2 -1
@@ -224,7 +224,8 @@ class CallVideoEngine(private val context: Context, private val id: Long) {
sensorOffset = it; LogManager.addLog("WARN", "call", "camera timestamp calibrated from arrival id=$id offset=$it")
}
val pts = (image.timestamp + offset) / 1000
if (pts <= lastPts || (lastPts >= 0 && pts - lastPts < 33333)) return@setOnImageAvailableListener
// Camera2 уже ограничена 30 fps. Порог 33333 мкс отбрасывал каждый второй кадр при дрожании часов.
if (pts <= lastPts) return@setOnImageAvailableListener
val key = needKey || lastKey < 0 || pts - lastKey >= 1_000_000
if (key && pendingRequest != 0L) {
val requestId = pendingRequest; pendingRequest = 0