Let call service retain video ownership while asynchronous shutdown is pending

This commit is contained in:
evgeny committed 2026-10-29 13:34:24 +01:00
1 parent 12db99531f
commit 1ddd2a4a0b
2 files changed
+5 -4

No files matched your search

@@ -406,8 +406,8 @@ class CallService : Service() {
audio.onFailure = null
audio.router.onChanged = null
video?.let { owned -> try {
owned.stop()
video = null
if (owned.stop()) video = null
else LogManager.addLog("DEBUG", "CallService", "video cleanup pending id=$id; service retains owner")
} catch (e: Exception) {
LogManager.addLog("ERROR", "CallService", "video stop failed id=$id; retained for retry: $e")
} }
@@ -584,8 +584,8 @@ class CallVideoEngine(private val context: Context, private val id: Long) {
/** Main: запретить producers, join RX и закрыть native port, затем передать camera cleanup worker.
* Исключение до принятия cleanup не подтверждает stop; следующий вызов повторяет незавершённый этап. */
fun stop() {
if (stopCleanupPosted) return
fun stop(): Boolean {
if (stopCleanupPosted) return true
stopped = true; player.stop(); CallVideoNative.close(id)
check(handler.post {
observeOrientation(false)
@@ -600,5 +600,6 @@ class CallVideoEngine(private val context: Context, private val id: Long) {
"Video cleanup worker rejected stop"
}
stopCleanupPosted = true
return true
}
}