Video Decode Worker
app.application.managers.video_decode_workerCentralizes video decode worker activation and deactivation per session.
See Also
VideoDecodeWorker— performs frame decodingSessionInitializer— attaches decoding resources to a session
Layer: Application. Context: Coordinates session-scoped lifecycles for application workers and resources.
VideoDecodeWorkerManager
Manages VideoDecodeWorker activation and deactivation on a per-session basis.
Responsibilities
- Activate a session's decode worker (start buffering frames from the current playback position).
- Deactivate a session's decode worker (stop buffering, free memory).
This manager centralises the worker-toggle logic that previously lived
inside SessionService._activate_video_decode_worker_for_session_id
and SessionService._deactivate_video_decode_worker_for_session_id,
giving SessionService a narrower single responsibility.
ValueError exceptions from set_active() are intentionally swallowed
here to preserve the original silent-return behaviour: they indicate that
the worker is in a transient view_state (e.g. not yet started) where the
toggle cannot be applied.
The session repository is injected, so the manager is independently
unit-testable without a live Application instance.
| PARAMETER | DESCRIPTION |
|---|---|
session_repo
|
Interface used to resolve sessions and coordinate their decode workers.
TYPE:
|
__init__(session_repo: UIApplicationInterface) -> None
activate(s_id: SessionId) -> None
Resume the video decode worker for s_id (start buffering frames).
Seeks to the session's current playback position so the ring buffer is filled with the frames the user is about to see.
| PARAMETER | DESCRIPTION |
|---|---|
s_id
|
Session ID of the target session.
TYPE:
|
Note
Silently returns if the worker raises ValueError (transient
worker view_state — mirrors the original SessionService behaviour).
deactivate(s_id: SessionId) -> None
Pause the video decode worker for s_id (stop buffering, free RAM).
Clears the ring buffer immediately to reclaim the memory used by pre-decoded frames.
| PARAMETER | DESCRIPTION |
|---|---|
s_id
|
Session ID of the target session.
TYPE:
|
Note
Silently returns if the worker raises ValueError (transient
worker view_state — mirrors the original SessionService behaviour).
switch_active_session(old_s_id: SessionId | None, new_s_id: SessionId) -> None
Perform the canonical old→new active-session decode-worker transition.
Pauses the old session's decode worker (if any) then resumes the new
one. The method is a no-op when old_s_id == new_s_id so that
callers do not need to guard against redundant switches themselves.
| PARAMETER | DESCRIPTION |
|---|---|
old_s_id
|
Previously active session ID, or
TYPE:
|
new_s_id
|
Newly active session ID.
TYPE:
|
Note
Individual activate / deactivate calls preserve their
existing ValueError tolerance semantics.