Browse Source

Log call video surface lifetime and preview visibility

master
evgeny 6 days ago
parent
commit
8582d2e2b0
  1. 7
      tools/chatgui-android/app/src/main/java/com/utun/chat/data/CallVideoEngine.kt
  2. 6
      tools/chatgui-android/app/src/main/java/com/utun/chat/data/CallVideoPlayer.kt

7
tools/chatgui-android/app/src/main/java/com/utun/chat/data/CallVideoEngine.kt

@ -217,7 +217,12 @@ class CallVideoEngine(private val context: Context, private val id: Long) {
lastCaptureAt = now
if (previewFrames.subscriptionCount.value > 0 && now - previewAt >= 200_000_000) {
previewAt = now
try { previewFrames.value = cameraPreview(image, f.rotation, mirror) }
try {
val preview = cameraPreview(image, f.rotation, mirror)
if (previewFrames.value == null) LogManager.addLog("INFO", "call",
"camera preview visible id=$id size=${preview.width}x${preview.height} rotation=${f.rotation} mirror=$mirror")
previewFrames.value = preview
}
catch (e: Exception) { LogManager.addLog("WARN", "call", "camera preview failed: ${e.message}") }
}
val offset = if (realtime) now - SystemClock.elapsedRealtimeNanos() else sensorOffset ?: (now - image.timestamp).also {

6
tools/chatgui-android/app/src/main/java/com/utun/chat/data/CallVideoPlayer.kt

@ -45,6 +45,7 @@ internal class CallVideoPlayer(private val id: Long, private val failure: (Strin
if (next.detach != null && output?.surface !== next.detach) continue
close(); output?.release?.invoke(); output = next; surface = next.surface
pending = null; displayed.value = null; CallVideoNative.requestKey(id)
LogManager.addLog("INFO", "call", "video output attached=${surface != null} call=$id")
}
val valid = NativeLib.callAudioClock(id, now / 1000, clock) && clock[5] != 0L
if (valid && sourceEpoch != clock[1]) {
@ -55,7 +56,10 @@ internal class CallVideoPlayer(private val id: Long, private val failure: (Strin
if (held >= 0 && valid && heldPts <= clock[4]) {
val render = heldPts >= clock[4] - 500_000
decoder!!.releaseOutputBuffer(held, render); held = -1
if (render) { displayed.value = format; lastRendered = now }
if (render) {
if (displayed.value != format) LogManager.addLog("INFO", "call", "video visible call=$id format=$format")
displayed.value = format; lastRendered = now
}
lastProgress = now
}
if (decoder != null && held < 0) {

Loading…
Cancel
Save