Skip to content

feat(playback): list every embedded text track as an on-demand HLS rendition - #3273

Closed
Quick104 wants to merge 8 commits into
feat/subtitle-kept-tracksfrom
feat/subtitle-renditions-all
Closed

Quick104 wants to merge 8 commits into
feat/subtitle-kept-tracksfrom
feat/subtitle-renditions-all

Conversation

@Quick104

@Quick104 Quick104 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: #1406
Validation tasks: none

In an HLS transcode or copy remux, Silo carries only the selected embedded text track as a WebVTT rendition, written by the stream's FFmpeg. Picking another track means a new FFmpeg and a new stream, so the viewer waits through a restart, and a player's own subtitle menu can't offer the other tracks because the playlist doesn't list them. On a file with 22 subtitle tracks, the viewer sees one.

This pull request lists every embedded text track of an HLS plan as a WebVTT rendition, for clients that ask for it. A rendition's segments are read when requested, through the file's index (#3270) or the kept track (#3272), independent of how far the transcode has got. Switching subtitles becomes a replan that keeps the running stream.

Depends on #3272, and through it on #3270 and #3271. The base is #3272's branch.

Approach

  • Opt-in. A client sends hls_subtitle_renditions_all_v1 (with hls_subtitle_renditions_v1, and hls_remux_subtitle_renditions_v1 for a copy remux) to /api/v2, which advertises it. Other clients get today's single rendition.
  • Playlist. One SUBTITLES group lists the tracks in inventory order, with NAME set to the row's label made unique, LANGUAGE as BCP 47, FORCED, AUTOSELECT=YES, and DEFAULT=YES only on the selected track. Each listed inventory row carries hls_rendition {group_id, name, index}, and subtitle.hls_rendition gains the selected one's name and index.
  • Segments. sub_<track>_NNNNN.vtt (playlist silo_rendition=subtitles&silo_track=<track>) is built on request: the window's packets go through the same FFmpeg WebVTT options on the clock the stream's own cue output uses, then through today's windows, origins, spans and X-TIMESTAMP-MAP. A segment ahead of FFmpeg carries its cues at once. Indexes, start times and windows are cached per process.
  • Fallback. The planner reads the index at start, with one 3 s bound for every planning pass of a start or replan. If it can't read the file, or can't find the selected track, the plan keeps today's single pipeline rendition.
  • Switching. A track_change, or a failure_recovery classified subtitle_track_changed, on the same file and set of renditions keeps the running stream and HLS generation. Turning subtitles off keeps it too.
  • Failures. A read that fails or runs out of time answers 404, so the player retries; only a track the file can't give answers an empty document. The plan records the source's size and modification time, and segments refuse any other version.
  • Executors. Stream tokens that carry renditions use new methods (transcode_subtitle_renditions_v1, transcode_copy_fmp4_subtitle_renditions_v1), so an older binary refuses them instead of rebuilding the stream with one rendition. Nodes advertise hls_on_demand_subtitle_renditions_v1 and attest the track count, recipes freeze the tracks (version 6), and the proxy relays the new methods and segment names.
  • Shared index cache. One process-wide index cache (playback.SubtitleIndexes, 64 MiB) serves feat(playback): keep embedded subtitle tracks and serve sidecars through the index #3272's kept-track reads and these segments. A shared index read now gives up after 30 s, so one hung read on a stalled mount no longer blocks every later caller of that file.
  • /api/v1 never negotiates this, and its frozen decisions drop the new fields.
  • Docs: docs/architecture/playback-protocol-v3.md, embedded-subtitle-index.md, docs/transcode-node-api.md and docs/playback-api.md, with the decision schema, a fixture, OpenAPI and generated web types.
  • Clients: a Roku client change, not merged yet, uses it. Apple and Android don't send the feature yet; no follow-up is filed for them. jellycompat keeps its own HLS subtitle delivery.

Validation

  • Tests cut every segment of a track both ways, on demand and from the stream's own rendition, and compare the bytes in 24 real-FFmpeg cases: an encode (MPEG-TS) and a copy remux (MPEG-TS and fMP4), from the start and after a seek, for two tracks, on a source whose clock starts at zero and one whose video starts after its subtitles. Another test compares kept-track reads with source reads the same way. Planner, handler and node tests cover the playlist and names, the inventory rows, fallback without an index, segment failures, rehoming, recipe cards and node routing, the switch and recovery that keep the stream, Off, and the /api/v1 view.
  • go build ./... and go vet ./... pass.
  • Full pre-PR gate from CONTRIBUTING.md on this branch: pass, with three exceptions. Two jellycompat tests fail on main too (TestPlaybackInfoWithoutStripOrToneMapStillHasNoRoute, TestPlaybackInfoSkipsStripWhenRPUCannotBeStripped). make verify-actionlint rejects the local binary's version string; actionlint itself passes. The size ratchet failed in that run on feat(playback): keep embedded subtitle tracks and serve sidecars through the index #3272's subtitle_cache.go; after feat(playback): keep embedded subtitle tracks and serve sidecars through the index #3272 moved its eviction code into a new file, build, vet, make lint-changed, make verify-size-ratchet and the playback package tests pass again here.
  • End to end on a TCL Roku TV (Roku OS 15.3.4), against a server built from this stack, with a Roku build that sends the feature:
    • Copy remux of a file with 22 SubRip tracks: the multivariant playlist listed all 22, with DEFAULT=YES on the selected English track. The subtitle playlist listed all 3,482 segments up front; segments came back in about 3 ms with correctly timed cues, and the TV drew them.
    • Switching from English to a commentary track in the player's options: the replan took 25 ms and reused the running stream (no new FFmpeg), and commentary cues appeared within about 2 s.
    • A bandwidth-limited transcode started with subtitles off: renditions were listed and nothing was drawn. Turning on a Chinese ASS track in place reused the stream, and the text appeared.
  • Not verified: Apple and Android clients (they don't send the feature), a node-hosted stream on a device, and rendition names on files whose tracks are all titled the same: they read "SUBRIP", "SUBRIP (2)" and so on, because NAME uses the track title.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/pr-3273/

Risks

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code in T3 Code
  • Tool(s): Claude Code
  • Model(s): claude-opus-5-5
  • Involvement: Fully AI-generated, human verified. Verified on a TCL Roku TV (Roku OS 15.3.4) as described under Validation; Apple and Android clients were not device-tested, and node-hosted streams were not exercised on a device.
  • Adversarial review: a separate Claude Code agent (claude-opus-5-5) reviewed the renditions branch for correctness and failure handling. Its findings, all fixed in this branch: rehoming and token rebuilds lost the renditions' names, languages and FORCED; turning subtitles off on a single-rendition stream restarted it; tokens with renditions used the old method, so an older binary could rebuild the stream with one rendition; a failure_recovery classified subtitle_track_changed restarted the stream; failed or slow reads answered empty segments instead of a retryable 404, as did a planned copy's segment no generation reached; index loads had no bound, and one hung shared read blocked every later caller; segments didn't check the source version; and smaller items (the MPEG-TS epoch chosen on the wrong clock, a 90 kHz conversion that could overflow, repeated track numbers, LANGUAGE not canonical BCP 47). A later pass found /api/v1 decisions carrying the new rendition fields; fixed.

🤖 Generated with Claude Code

Note

Add on-demand HLS subtitle renditions for every embedded text track

  • Each cue-indexed embedded text track can now be listed as its own WebVTT HLS rendition, served on demand through a multivariant playlist with track-specific segment names (sub_<track>_NNNNN.vtt). Segments are read from the source index and converted with FFmpeg; cue-cache size, conversions, loads, and start times are bounded.
  • Planning (transcode and remux), recipes, stream tokens, transcode-node protocol, and the OpenAPI/web schemas all carry the new rendition track list, its source file version, and the hls_subtitle_renditions_all_v1 client feature. Nodes must advertise the new TransportFeatureHLSOnDemandSubtitleRenditionsV1 transport feature; plans fall back to the single pipeline rendition when a node lacks support or an on-demand plan already failed.
  • Replan and stream reuse preserve the running stream's rendition set; subtitle-track-changed recovery on an on-demand stream is treated as a track change.
  • Shared embedded-subtitle index reads now use a 30-second timeout in cache.go, and planning cue-index reads use a 3-second shared deadline in playback_v3.go.
  • Behavioral Change: executable recipes move to version 6 (executable_recipe_v3.go); manifest/segment requests for unlisted renditions return HTTP 404 via ErrSubtitleRenditionNotFound; ServeSubtitleSegment and ParseSubtitleSegmentNumber in subtitle_rendition.go now accept segment names instead of numbers; subtitle segment documents drop the duration fallback and MPEG-TS epoch adjustment; frozen V1 decision responses strip inventory HLS rendition metadata.

Macroscope summarized 7bde004.

Quick104 and others added 5 commits October 30, 2026 09:05
…ndition

A client that sends hls_subtitle_renditions_all_v1 (with
hls_subtitle_renditions_v1, and hls_remux_subtitle_renditions_v1 for a
copy remux) to /api/v2, which now advertises it, gets every embedded text
track of an HLS plan as a WebVTT rendition in one SUBTITLES group:

- The multivariant playlist lists the tracks in inventory order, NAME the
  row's label made unique, LANGUAGE, FORCED, AUTOSELECT=YES, and
  DEFAULT=YES only on the selected track. Each listed inventory row
  carries hls_rendition {group_id, name, index}; subtitle.hls_rendition
  keeps naming the selected one, now with its name and index.
- Each segment (sub_<track>_NNNNN.vtt, playlist
  silo_rendition=subtitles&silo_track=<track>) is read when requested:
  the window's packets come from the source's index (embeddedsub) and go
  through the same FFmpeg WebVTT options on the clock the stream's own cue
  output uses, then are cut with today's windows, origins, spans and
  X-TIMESTAMP-MAP. Segments ahead of FFmpeg carry their cues at once.
  Indexes, start times and windows are cached per process.
- The planner reads the index at start (3 s bound). A file it can't read,
  or whose selected track it can't find, keeps the single pipeline
  rendition. Replans on the same file reuse the set the stream serves.
- A track_change, or a subtitle_track_changed recovery, that keeps the
  same set keeps the running stream and generation.
- Executors: nodes advertise hls_on_demand_subtitle_renditions_v1 and
  attest the track count; recipes freeze the tracks (version 6); recipe
  cards carry them, stream tokens only their numbers and the default.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Cache.Index ran a shared miss detached from its callers with no
deadline. A read that hung, as on a stalled network mount, never
finished, so every later caller of that file waited out its own
context. The shared read now gets 30 s: at the deadline its callers
fail and the next caller reads again, while a read still blocked
finishes on its own and is dropped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review fixes for on-demand renditions:

- Stream tokens that carry them use a new method
  (transcode_subtitle_renditions_v1, or its copy-fMP4 twin), so older
  binaries refuse to rebuild the stream with one rendition for every
  silo_track. The proxy relays both methods.
- Rehoming and the API's token rebuild take the renditions' names,
  languages and FORCED from the attempt's frozen recipe when it lists
  the same tracks; only a node rebuilding from a token alone names them
  by number.
- A replan on the playing HLS stream's file pins the renditions it
  serves, none included, so turning subtitles off or moving to a
  sidecar on a single-rendition stream keeps it again. A
  failure_recovery classified subtitle_track_changed on an on-demand
  stream is a track_change: same file, the named track, Off when none
  is named.
- The plan records the source version its index read; segments refuse
  any other. A read that fails or runs out of time answers 404 for the
  player to retry, as does a planned copy's segment no generation
  reaches; only a track the file can't give answers empty. The
  conversion slot now also bounds ReadPackets.
- One 3 s bound and one read per file cover every planning pass of a
  start or replan, including the output-change fallback.
- Nits: the MPEG-TS epoch is chosen on the cue clock, 90 kHz conversion
  can't overflow, repeated track numbers are listed once, segments
  require an active recipe, start-time probes are shared, and LANGUAGE
  is canonical BCP 47.
- The protocol doc tells clients to disable subtitle selection
  explicitly when subtitles are off.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…dows from kept tracks

On top of kept tracks:

- The process keeps one embeddedsub.Cache (playback.SubtitleIndexes)
  for sources and kept tracks alike. Kept-track serving (keptsub),
  on-demand renditions and the planner's check for them read through
  it, so a file indexed for one is indexed for all.
- On a server that keeps tracks, an on-demand segment reads its window
  from the track's kept copy when there is one (SetRenditionKeptTracks,
  wired in main), before reading the source. Its packets keep the
  source's timestamps, so the bytes match a source read; a test cuts
  every segment both ways. A window open to the end, or a track the
  recipe names without its catalog identity, still reads the source.
  Rendition tracks now record their codec, and transcode options the
  media file, to find the kept copy.
- The end-to-end replan tests run on the /api/v2 service, since /api/v1
  decisions are frozen.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The frozen /api/v1 decision drops each inventory row's hls_rendition and
subtitle.hls_rendition's index, as it drops the other fields that came
after the freeze. /api/v1 never negotiates on-demand renditions, so
this only matters for a plan built for /api/v2 answered there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-triage silo-triage Bot added the size/XXXL 3000+ added + deleted lines (all files); change volume, not priority. label Oct 30, 2026
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 43 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 53d6d0b6-c280-4a29-b515-4e98f8908a10
Commits

Reviewing files that changed from the base of the PR and between d27c425 and 7bde004.

Files selected for processing: 50
  • Makefile
  • cmd/playbackfixtures/hls_subtitle_rendition.go
  • cmd/playbackfixtures/main.go
  • cmd/silo/main.go
  • contracts/api/v2/openapi.json
  • docs/architecture/embedded-subtitle-index.md
  • docs/architecture/playback-protocol-v3.md
  • docs/design/schemas/playback-v3/v3/decision-response.schema.json
  • docs/design/schemas/playback-v3/v3/fixtures/valid/hls-subtitle-rendition-decision_response.json
  • docs/design/schemas/playback-v3/v3/fixtures/valid/hls-subtitle-renditions-all-decision_response.json
  • docs/design/schemas/playback-v3/v3/fixtures/valid/learned-limit-decision_response.json
  • docs/playback-api.md
  • docs/transcode-node-api.md
  • internal/api/handlers/playback.go
  • internal/api/handlers/playback_test.go
  • internal/api/handlers/playback_transcode_rehome.go
  • internal/api/handlers/playback_v3.go
  • internal/api/handlers/playback_v3_subtitle_facts_test.go
  • internal/api/handlers/playback_v3_subtitle_rendition_test.go
  • internal/apiv2/playback_delivery.go
  • internal/apiv2/schema_ownership_test.go
  • internal/embeddedsub/cache.go
  • internal/embeddedsub/read_test.go
  • internal/keptsub/store.go
  • internal/noderecipe/store_test.go
  • internal/playback/auto_transcode_pipeline_test.go
  • internal/playback/executable_recipe_v3.go
  • internal/playback/executable_recipe_v3_test.go
  • internal/playback/plan_key_v3.go
  • internal/playback/plan_v3.go
  • internal/playback/protocol_v3.go
  • internal/playback/recipecard.go
  • internal/playback/subtitle_inventory_v3.go
  • internal/playback/subtitle_packets.go
  • internal/playback/subtitle_rendition.go
  • internal/playback/subtitle_rendition_spans.go
  • internal/playback/subtitle_rendition_test.go
  • internal/playback/subtitle_rendition_tracks.go
  • internal/playback/subtitle_rendition_tracks_test.go
  • internal/playback/subtitle_source.go
  • internal/playback/testdata/protocol_v3/hls-subtitle-rendition-decision_response.json
  • internal/playback/testdata/protocol_v3/hls-subtitle-renditions-all-decision_response.json
  • internal/playback/testdata/protocol_v3/learned-limit-decision_response.json
  • internal/playback/transcode.go
  • internal/proxy/media_routes_test.go
  • internal/proxy/server.go
  • internal/streamtoken/token.go
  • internal/transcodenode/server.go
  • internal/transcodenode/subtitle_rendition_test.go
  • web/src/api/v2/schema.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T20:10:16.733294Z 7bde004 New commits
🔒 Security Review ✅ Completed 2026-10-31T20:11:03.753519Z 7bde004 New commits

Security findings

Advisory findings (1)

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@macroscopeapp

macroscopeapp Bot commented Oct 30, 2026

Copy link
Copy Markdown

The Evidence section says evidence will be published once the PR has a number, but PR #3273 is numbered and no evidence link or captures are present.

  • internal/playback/plan_v3.go and internal/playback/subtitle_rendition.go: HLS playlists and playback decisions now expose all readable embedded text tracks and change the default subtitle option. Add before-and-after playlist or API response excerpts for the same media/request, identifying the surface and build or commit.
  • internal/api/handlers/playback_v3.go: switching among those tracks can keep the running stream instead of restarting it. Add a short recording of the client selection and switch, identifying the client surface and build or commit.

Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.

Posted via Macroscope — Visible change evidence

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 608ac76950

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/api/handlers/playback_v3.go Outdated
Comment on lines +1372 to +1374
readCtx, cancel := context.WithDeadline(ctx, reads.deadline)
defer cancel()
indexed, err := playback.CueIndexedSubtitleTracks(readCtx, file.FilePath)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include the initial file stat in the index-read timeout

When the API server's media mount stalls, this call can block playback planning indefinitely despite the three-second deadline. CueIndexedSubtitleTracks calls embeddedsub.Cache.Index, which synchronously runs fspath.Stat (os.Stat) before reaching its context-aware wait; canceling readCtx cannot interrupt that syscall. This also prevents falling back to the pipeline rendition when a healthy remote executor could still serve the file. Run the entire lookup, including its initial stat, behind the bounded wait so start/replan can actually fall back when the deadline expires.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 608ac76950

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Comment on lines +601 to +605
readCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), subtitleSegmentProductionWait)
go func() {
defer cancel()
c.load(readCtx, key, load, read)
}()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛡️ Codex Security Review · Automatically triggered

P2 Badge Security: Cancel abandoned subtitle rendition loads

An authenticated profile with an on-demand-rendition HLS session can request and cancel many distinct sub_<track>_<segment>.vtt URLs. Each cache miss strips request cancellation and starts a goroutine before the 8-slot read/conversion semaphore, so the handler exits while queued file reads and FFmpeg conversions continue for up to 30 seconds. Live encodes also accept segment numbers outside the advertised playlist, providing arbitrary cache keys. Rate limiting and the worker cap mitigate active work but do not bound queued goroutines or loading entries. Cancel a load when its last waiter leaves, bound the queue, and reject out-of-range segments.

Useful? React with 👍 / 👎.

…s-all

# Conflicts:
#	docs/design/schemas/playback-v3/v3/decision-response.schema.json
#	internal/playback/subtitle_inventory_v3.go
Quick104 and others added 2 commits October 31, 2026 15:59
A segment request that missed the window cache started a detached read
that ran on for up to 30 s after the request left, before even taking a
conversion slot. A client could request and cancel many segments and
leave reads and FFmpeg conversions queued behind them. Now:

- A window's read stops when the last request waiting on it gives up.
- At most 256 window reads run or queue at once; a miss past that
  answers 404, which the player retries.
- An encode's segment past its playlist's synthetic grid answers 404
  instead of reading a window beyond the source.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…included

The start's 3 s bound on reading a source's index covered only the wait
on the shared read. The index cache stats the file first, and a stat on
a stalled mount ignores the context, so planning could wait on it past
the deadline instead of keeping the pipeline rendition. The lookup now
runs on its own and planning stops waiting at the deadline.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7bde0046d0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// the frozen surface neither advertises nor negotiates them.
func NativeServerFeaturesV3() []string {
return append(ServerFeaturesV3(), FeatureBufferingQualityV1, FeaturePlaybackPlanSummaryV1, FeatureSubripSidecarV3, FeatureMarkerThumbnailsV3, FeatureHLSSubtitleRenditionsV3, FeaturePlanActiveQualityV3, FeatureHLSRemuxSubtitleRenditionsV3, FeatureHLSCopyMPEGTSV3, FeatureHLSVariableSubstitutionV3, FeatureCodecChannelCeilingsV3, FeatureNativeEmbeddedLimitationsV3)
return append(ServerFeaturesV3(), FeatureBufferingQualityV1, FeaturePlaybackPlanSummaryV1, FeatureSubripSidecarV3, FeatureMarkerThumbnailsV3, FeatureHLSSubtitleRenditionsV3, FeaturePlanActiveQualityV3, FeatureHLSRemuxSubtitleRenditionsV3, FeatureHLSCopyMPEGTSV3, FeatureHLSVariableSubstitutionV3, FeatureCodecChannelCeilingsV3, FeatureNativeEmbeddedLimitationsV3, FeatureHLSSubtitleRenditionsAllV3)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge File the required Apple and Android follow-up work

This adds a client-visible playback capability, but the commit description explicitly says Apple and Android do not negotiate it and no follow-up is filed for either. AGENTS.md requires follow-up work to be completed or filed for both first-party clients; keeping the feature opt-in avoids breaking them but leaves the required coordination unfinished. File the client follow-ups, or document why each platform needs no work, before considering this change complete.

AGENTS.md reference: AGENTS.md:L150-L156

Useful? React with 👍 / 👎.

// read is read (SubtitleRenditionSource). Windows are kept per file version,
// track and clock, so every session on the file shares them.
func readOnDemandCues(ctx context.Context, opts TranscodeOpts, number uint64, segNum int, span subtitleCueSpan, window subtitleCueWindow) ([]byte, error) {
idx, err := subtitleIndexes.Index(ctx, opts.InputPath)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Bound the initial stat when serving subtitle segments

If the media mount stalls after playback starts, every on-demand subtitle segment can block indefinitely here: embeddedsub.Cache.Index synchronously calls fspath.Stat before its context-aware wait. This happens before renditionCues.get establishes its bounded read, so neither that timeout nor a client disconnect releases the handler. The planning lookup now wraps this same operation with lookupWithin, but segment serving still bypasses that protection. Put the entire segment lookup, including the initial stat, behind a bounded wait so it can return the intended retryable error.

Useful? React with 👍 / 👎.

@Quick104

Copy link
Copy Markdown
Contributor Author

Superseded by #3331, which combines this change with the rest of the stack for review.

@Quick104 Quick104 closed this Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request priority: P2 Limited scope, workaround exists, or polish size/XXXL 3000+ added + deleted lines (all files); change volume, not priority. stacked Base is another open PR; merge in stack order named in the body

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant