Release audio holds at video EOF and stop Android batches promptly

This commit is contained in:
evgeny committed 2026-10-21 00:15:34 +02:00
1 parent b2efab9806
commit 32e648ea9e
2 files changed
+3 -1

No files matched your search

@@ -274,6 +274,7 @@ class StreamPlayerEngine(private val group: Long, private val source: Long, priv
val deviceLead = playback?.leadUs ?: 0
var consumed = 0
for (work in 0 until 32) {
if (!running) break
video.step(position, System.nanoTime() / 1000)
needsAudio = !audioInputEnded && (playback?.needsInput ?: true)
val audioAhead = if (!audioInputEnded && (!audioEnabled || needsAudio) && records.audios == 0) deviceLead + 80000 else -1L
@@ -340,6 +341,7 @@ class StreamPlayerEngine(private val group: Long, private val source: Long, priv
else -> error("Unknown media event=$kind")
}
}
if (!running) break
if (!ended && (!opened || waitingKey) && System.nanoTime() > deadline) error("Viewer open timeout")
if (!playbackStarted && video.firstOutputPts != null) playbackStarted = true
if (playbackStarted && playback != null && ready >= 0) {