A stream given back by full screen never plays on unseen (build 62)
release-gate / verify (push) Successful in 12m37s
pauljd/davidson-ci: Davidson CI / quality (push) Failing after 2m23s
pauljd/davidson-ci: Davidson CI / ai-review (push) Failing after 1m40s

Paul, 18 November 2026: Sleepaway Camp on Orbit Horror wouldn't close; changing channel played two sounds, even on the
home screen. Back from full screen hands the stream to the guide's picture; Home pressed before the picture took it
(1.4 s later here) left it owned by nobody, playing on behind everything. A given-back stream not taken within 4 s is now
closed, and so is one still waiting when Orbit leaves the screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 11:40:26 +00:00
co-authored by Claude Opus 5.5
parent 85f662a80b
commit afdff6b38f
4 changed files with 29 additions and 3 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ plugins {
id("org.jetbrains.kotlin.plugin.compose")
}
/** The release's build number: versionCode is this x 10 plus the edition's channel. */
val ORBIT_BUILD = 61
val ORBIT_BUILD = 62
android {
namespace = "tv.orbit.classic"
compileSdk = 36
@@ -241,12 +241,13 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea
val observer = LifecycleEventObserver { _, event ->
if (event == Lifecycle.Event.ON_STOP) {
clearPassword(); job?.cancel(); watchingChannel = false; busy = false
liveHandoff.dropReturned()
if (session == null && !restoring) sessionSlot.clear()?.let { active -> EmbyCleanup.run { active.close() } }
}
}
lifecycle.addObserver(observer)
onDispose {
clearPassword(); job?.cancel(); lifecycle.removeObserver(observer)
clearPassword(); job?.cancel(); lifecycle.removeObserver(observer); liveHandoff.dropReturned()
sessionSlot.clear()?.let { active -> EmbyCleanup.run { active.detach() } }
}
}
@@ -50,8 +50,33 @@ internal class LiveHandoff {
fun take(): LiveStream? = handed.also { handed = null }
/** Left by the full-screen player on the way out, for the picture to carry on with. */
var returned: LiveStream? = null
private var returnedSession: EmbySampleSession? = null
/**
* Full screen gives its stream back for the picture. One the picture doesn't take within a few seconds (Home pressed
* straight after Back, or the picture resting) is closed, and so is one still waiting when Orbit leaves the screen, so it
* never plays on unseen (Paul, 18 November 2026: Sleepaway Camp played on behind the home screen, under the next channel).
*/
fun giveBack(stream: LiveStream, session: EmbySampleSession) {
dropReturned()
returned = stream; returnedSession = session
android.os.Handler(android.os.Looper.getMainLooper()).postDelayed({
if (returned === stream) { android.util.Log.i("OrbitSchedule", "picture back channel=${stream.channelNumber} untaken=true"); dropReturned() }
}, RETURN_TAKE_MS)
}
/** Closes a given-back stream nobody took. */
fun dropReturned() {
val stream = returned ?: return
returned = null
returnedSession?.let { stream.discard(it) }
returnedSession = null
}
}
/** How long a stream given back by full screen waits for the picture to take it. */
internal const val RETURN_TAKE_MS = 4_000L
private fun closeLiveStream(session: EmbySampleSession, plan: EmbyPlaybackPlan, player: ExoPlayer) {
val position = player.currentPosition
player.release()
@@ -219,7 +219,7 @@ internal fun ScheduledChannelPlayer(session: EmbySampleSession, channel: SampleC
// The ident itself is drawn below, over the whole window. This only quietens the programme under it.
ident = if (phase == IdentPhase.Showing) { {} } else null, intro = introPlayback, announce = announce, onUnplayable = onUnplayable, audioPreference = audioPreference,
onHandBack = { running ->
if (handoff != null && clockOffsetMs == 0L) { handoff.returned = LiveStream(channel.number, current.startMs, plan, running); true } else false
if (handoff != null && clockOffsetMs == 0L) { handoff.giveBack(LiveStream(channel.number, current.startMs, plan, running), session); true } else false
},
window = window, onShift = onShift, onLive = onLive, holdStart = !catchUpIdentDone, squeeze = squeeze,
onFirstFrame = { if (heldIdent?.startMs == current.startMs) heldIdent = null; catchUpPicture = true },