Skip to content

feat(lifecycle): retain paused video pipelines on host opt-in - #870

Open
jonluca wants to merge 1 commit into
superuser404notfound:mainfrom
jonluca:feat/paused-pipeline-retention
Open

jonluca wants to merge 1 commit into
superuser404notfound:mainfrom
jonluca:feat/paused-pipeline-retention

Conversation

@jonluca

@jonluca jonluca commented Oct 25, 2026 •

Copy link
Copy Markdown

Summary

Add an opt-in for hosts that want a paused video pipeline to survive background suspension, avoiding a rebuild when the system preserves it. Recover a failed software video queue before waking its feeder, while leaving healthy buffered frames intact.

What changed

  • Add retainsVideoPipelineWhenBackgrounded, defaulting to false and applying only to paused sessions.
  • Preserve the existing playing-session, audio-only, PiP and in-flight load/seek policies.
  • Flush a failed software video queue before play resumes. A healthy queue is not flushed, even when full.
  • Document the host's responsibility to reload if the system invalidates a retained decoder; add policy and play-order regression tests.

Test plan

  • Device / OS: Apple M4 Max, macOS 27.0.1, Xcode 27.1.
  • Source media: policy and injected queue-status tests; the existing two-frame 64x64 HEVC Main 10 MP4 fixture with PQ/BT.2020 and HDR10+ metadata exercises the in-flight load/background path.
  • 60 focused background/renderer Swift tests and 4 public API documentation tests pass, covering keepalive, grace windows, in-flight load decisions and selection preservation.
  • AetherEngine builds for arm64 iOS18 simulator with -warnings-as-errors.
  • Documentation link validation and git diff --check pass.
  • Physical iOS/tvOS suspension was not exercised. Retention remains opt-in because system-invalidated decoder sessions can still require a reload.

Checklist

  • CHANGELOG.md updated
  • Conventional commit
  • Engine-owned behavior
  • Public API documented

Copilot AI balanced review requested due to automatic review settings October 25, 2026 16:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Resuming a retained session while backgrounded bypasses playing-session policy, allowing disabled background playback or continued software video feeding.

1 open issue
What changed in this PR

Adds opt-in retention of paused video pipelines to avoid rebuilding them after background suspension when the system preserves the decoder.

Changes:

  • Adds retainsVideoPipelineWhenBackgrounded, defaulting to false, to background lifecycle policy.
  • Recovers failed software video queues before playback resumes while preserving healthy queues.
  • Documents retention limitations and adds policy and recovery-order tests.
File Description
Tests/​AetherEngineTests/​SampleBufferRendererLookaheadTests.swift Tests failed-queue recovery order and healthy-queue preservation.
Tests/​AetherEngineTests/​BackgroundKeepaliveTests.swift Tests the opt-in default and paused-session policy.
Sources/​AetherEngine/​Renderer/​SampleBufferRenderer.swift Adds failed-queue recovery and queue injection for tests.
Sources/​AetherEngine/​Native/​SoftwarePlaybackHost.swift Recovers the video queue before resuming transport.
Sources/​AetherEngine/​AetherEngine.swift Exposes retention configuration and updates background policy.
docs/​api.md Documents retention behavior and host reload responsibility.
CHANGELOG.md Records the retention option and queue recovery behavior.

Review effort: Balanced

state: PlaybackState,
retainPausedVideoPipeline: Bool = false
) -> BackgroundAction {
if retainPausedVideoPipeline && state == .paused { return .doNothing }
@jonluca
jonluca force-pushed the feat/paused-pipeline-retention branch from da1f430 to 79c945f Compare October 25, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants