Repository navigation
Conversation
|
Warning Review limit reached
Next review available in: 47 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughModified ChangesPlayback route media source fallback
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 080a55cb97
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Native clients that call PlaybackInfo, reuse the returned PlaySessionId on the
/Videos/{id}/stream?static=true request, but send the *item* id as mediaSourceId
(per the Jellyfin MediaSource.Id == Item.Id convention) rather than Silo's
fileID-based source id got a 400 "Media source is required" and could not
direct-play at all.
The PlaySessionId branch of resolvePlaybackRoute returned findMediaSource's nil
result directly, with no fallback -- unlike the FindByRoute and
createStaticPlaySession paths. Because resolution returned a nil error,
HandleVideoStream's Static fallback never fired either, so every direct-play
request 400'd.
Fall back to the session's primary source only when mediaSourceId is empty or
equals the route item id (the MediaSource.Id == Item.Id convention), matching
Jellyfin's StreamingHelpers. Any other unmatched id -- a stale/foreign id, or a
wrong version on a multi-version item -- stays rejected so it can't silently
stream the wrong file. Exact source-id matches are unchanged.
…ms (#313) Native clients that call PlaybackInfo, reuse the returned PlaySessionId on the /Videos/{id}/stream?static=true request, but send the *item* id as mediaSourceId (per the Jellyfin MediaSource.Id == Item.Id convention) rather than Silo's fileID-based source id got a 400 "Media source is required" and could not direct-play at all. The PlaySessionId branch of resolvePlaybackRoute returned findMediaSource's nil result directly, with no fallback -- unlike the FindByRoute and createStaticPlaySession paths. Because resolution returned a nil error, HandleVideoStream's Static fallback never fired either, so every direct-play request 400'd. Fall back to the session's primary source only when mediaSourceId is empty or equals the route item id (the MediaSource.Id == Item.Id convention), matching Jellyfin's StreamingHelpers. Any other unmatched id -- a stale/foreign id, or a wrong version on a multi-version item -- stays rejected so it can't silently stream the wrong file. Exact source-id matches are unchanged.
Problem
Native clients that direct-play via
/Videos/{id}/stream?static=truefail with400 "Media source is required"and can't play back at all (even content the device supports natively) when they:PlaybackInfoand reuse the server-returnedPlaySessionIdon the stream request, andmediaSourceId(per the JellyfinMediaSource.Id == Item.Idconvention) rather than Silo's fileID-based media-source id.Negotiation succeeds (
PlaybackInforeturns 200, direct play), but the follow-up stream request 400s, so playback never starts.Root cause
resolvePlaybackRoutehas three resolution paths.FindByRouteandcreateStaticPlaySessionboth fall back tofirstMediaSourcewhen a namedmediaSourceIdmatches no stored source. ThePlaySessionId-hit path does not; it returnsfindMediaSource's nil result directly:Silo assigns each media source a fileID-based id (
EncodeIntID(EncodedIDMediaSource, fileID)), intentionally distinct from the item id so/Items/{id}/Downloadand detail/image routes can decode the file statelessly and multi-version files stay distinguishable. So a client sending the item id asmediaSourceIdnever matches,findMediaSourcereturns nil, and because resolution returns a nil error,HandleVideoStream'sStaticfallback (createStaticPlaySession) never fires either. The result is a hard 400 on every direct-play request.This slips past the #165 safety net, which only covers clients whose
PlaySessionIdis server-unknown (client-generated, so it falls through toFindByRoute). A client that callsPlaybackInfoand reuses the server'sPlaySessionIdlands in the strict branch instead.Fix
Give the
PlaySessionId-hit branch a primary-source fallback scoped to the convention it needs to satisfy: fall back to the session's primary source only whenmediaSourceIdis empty or equals the route item id. This mirrors upstream Jellyfin'sStreamingHelpers, which defaults tomediaSources[0]only for an empty or item-idmediaSourceIdand leaves any other unmatched id unresolved.The behavior delta is exactly one case: a known
PlaySessionIdplus an item-idmediaSourceIdnow serves the primary source instead of 400ing. Exact source-id matches and the empty-mediaSourceIdcase are unchanged. Any other unmatched id (a stale/foreign id, or a wrong version on a multi-version item) still returns 400, so it can't silently stream the wrong file. The media-source id scheme is left as-is.Test
Adds two tests:
TestHandleVideoStream_KnownPlaySessionItemIDMediaSourceServesFile— knownPlaySessionId+ item-idmediaSourceId: 400 before, serves the file (200) after.TestHandleVideoStream_KnownPlaySessionUnknownMediaSourceRejected— knownPlaySessionId+ a non-item, non-matching id: still 400 (guards the fallback scope).The full
internal/jellycompatsuite passes.