From 62b6a7596bc489bddcd1f5771abde970e6012c06 Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Tue, 15 Sep 2026 07:41:22 -0400 Subject: [PATCH] docs(streaming): trim the state-screenshot comments Co-Authored-By: Claude Opus 5 (1M context) --- backend/handler/streaming/broker.py | 5 ++--- backend/handler/streaming/states.py | 11 ++++------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/backend/handler/streaming/broker.py b/backend/handler/streaming/broker.py index 40da4357e..cd76ee399 100644 --- a/backend/handler/streaming/broker.py +++ b/backend/handler/streaming/broker.py @@ -38,9 +38,8 @@ TRANSFER_TIMEOUT = 60 SWAP_DISC_TIMEOUT = 120 CARD_HYDRATE_TIMEOUT = 120 CARD_TEARDOWN_TIMEOUT = 30 -# A state thumbnail, fetched while the claim is still held and the player waits -# on the exit screen. It is optional, so it gets a deadline of its own rather -# than the archive budget. +# An optional thumbnail, fetched while the claim is still held and the player +# waits on the exit screen, so it does not get the archive budget. STATE_SCREENSHOT_TIMEOUT = 10 # A pulled save archive can be large (PCSX2 ships whole 8 MB memory cards, a diff --git a/backend/handler/streaming/states.py b/backend/handler/streaming/states.py index b48599d89..558e885b5 100644 --- a/backend/handler/streaming/states.py +++ b/backend/handler/streaming/states.py @@ -191,8 +191,7 @@ def push_state_file( # PCSX2 embeds a PNG of the moment of save inside every .p2s savestate zip -# under this entry name (pcsx2/SaveState.cpp: EntryFilename_Screenshot), which -# is the fallback for a container that captured no frame of its own. +# under this entry name (pcsx2/SaveState.cpp: EntryFilename_Screenshot). _SCREENSHOT_ZIP_ENTRY = "Screenshot.png" SCREENSHOT_MAX_BYTES = 16 * 1024 * 1024 PNG_MAGIC = b"\x89PNG\r\n\x1a\n" @@ -204,8 +203,7 @@ def _is_png(data: bytes | None) -> bool: def extract_state_screenshot(emulator: str, state_content: bytes) -> bytes | None: """Pull the embedded frame PNG out of a savestate archive, or None when the - format carries no embedded screenshot. Only PCSX2 (.p2s zip) embeds one, - and it is reached only when /state-screenshot served nothing.""" + format carries no embedded screenshot. Only PCSX2 (.p2s zip) embeds one.""" if emulator != "pcsx2": return None try: @@ -222,9 +220,8 @@ def extract_state_screenshot(emulator: str, state_content: bytes) -> bytes | Non def fetch_state_screenshot(container: ResolvedContainer, slot: int) -> bytes | None: - """GET /state-screenshot from the broker: the container's own capture of the - stream, taken as the state was saved. A 404 means this state has no frame, - so it is not logged.""" + """GET /state-screenshot from the broker, the container's own capture of the + stream as the state was saved. A 404 means no frame, so it is not logged.""" result = broker.get_binary_safe( container, container.protocol.transfer_route(f"/state-screenshot?slot={slot}"),