Test Android frame pacing and extend hardware diagnostics to 60 fps

This commit is contained in:
evgeny committed 2026-10-20 00:13:48 +02:00
1 parent 0a73d140e6
commit 9bc3e7228c
2 files changed
+37 -5

No files matched your search

@@ -45,10 +45,11 @@ object CallVideoHevcProbe {
check(files.isNotEmpty()) { "No remote KEY files in $directory" }
for (file in files) {
val bytes = file.readBytes(); val inspected = checkNotNull(CallVideoNative.inspect(2, bytes))
val format = CallVideoFormat(1, inspected[0].toInt(), inspected[1].toInt(), codec = 2,
val fps = Regex("-fps(30|50|60)-").find(file.name)?.groupValues?.get(1)?.toInt() ?: 30
val format = CallVideoFormat(1, inspected[0].toInt(), inspected[1].toInt(), fps = fps, codec = 2,
level = inspected[2].toInt(), profile = inspected[3].toInt())
val implementation = checkNotNull(decoders.modes.firstOrNull { it.supports(format) })
CallVideoCodec.verifyDecode(format, List(FRAMES) { CallVideoCodec.Packet(1_000_000L + it * 33333, true, bytes) },
CallVideoCodec.verifyDecode(format, List(FRAMES) { CallVideoCodec.Packet(1_000_000L + it * 1_000_000L / fps, true, bytes) },
implementation.name)
report("remote PASSED file=${file.name} format=$format decoder=${implementation.name}")
}
@@ -63,7 +64,7 @@ object CallVideoHevcProbe {
report("production encoders=$modes decoders=$receiving")
for (mode in modes) for (portrait in listOf(false, true)) {
val format = CallVideoFormat(1, if (portrait) mode.size.height else mode.size.width,
if (portrait) mode.size.width else mode.size.height, codec = 2, level = mode.level, profile = mode.profile)
if (portrait) mode.size.width else mode.size.height, fps = mode.fps, codec = 2, level = mode.level, profile = mode.profile)
val implementation = checkNotNull(receiving.modes.firstOrNull { it.supports(format) })
CallVideoCodec(format, 1_000_000, mode.name).use { codec ->
codec.prepare()
@@ -74,13 +75,13 @@ object CallVideoHevcProbe {
val base = 2_000_000L + phase * 1_000_000L
val deadline = System.nanoTime() + 5_000_000_000L
while (packets.size < FRAMES && System.nanoTime() < deadline) {
if (input < FRAMES && codec.submit(null, base + input * 33333, input == 0)) ++input
if (input < FRAMES && codec.submit(null, base + input * 1_000_000L / format.fps, input == 0)) ++input
packets += codec.drain(); Thread.sleep(2)
}
check(packets.size == FRAMES && packets.first().key) { "Incomplete production encode" }
CallVideoCodec.verifyDecode(codec.format, packets, implementation.name)
report("production PASSED format=${codec.format} rate=$rate frames=${packets.size} decoder=${implementation.name}")
File(directory, "production-${format.width}x${format.height}-$phase.key").writeBytes(packets.first().bytes)
File(directory, "production-${format.width}x${format.height}-fps${format.fps}-$phase.key").writeBytes(packets.first().bytes)
}
}
}