Commit Graph

240 Commits

Author SHA1 Message Date
unkin-agent baa16b6586 fix: make transcode leases ownership-checked and cleanup-aware
Cleanup never matched a live session because the controller registered empty
manifest and segment paths, renewal was a read-modify-write that could revert a
takeover, and the takeover script compared an ISO date to a number, so it errored.

- populate the session record's manifest and segment paths from the playlist path
- renew the lease via a Lua compare-and-set on the owning pod
- store the lease expiry as unix milliseconds so the scripts can compare it
- retain the session record past its lease so an orphan can still be taken over
- test the Redis store against a real Redis, including the renew-vs-takeover race
- drop the live stream record nothing ever read back
2026-09-12 10:19:29 +10:00
unkin-agent e3571eb2a4 feat(session): record open live streams in the session store
Live stream ownership is only tracked in process memory, so no replica can tell
which pod holds a stream open once that pod is gone.

- persist a LiveStreamSession record when the live stream mappings change
- delete the record when the stream is closed
- keep closing the stream when the store is unreachable
2026-09-11 23:56:35 +10:00
Cody Robibero 420d44f638 Merge commit from fork
Fix broken access control in session management
2026-08-30 14:40:25 -04:00
itsb f0c5370e27 Preserve unknown idle playback position 2026-08-16 09:09:18 -05:00
itsb 499e64b1c3 Use client-reported position for idle playback cleanup 2026-08-14 23:31:39 -05:00
Shadowghost 4de43d36dd Require session ownership for additional users, capabilities and viewing reports 2026-08-14 14:50:07 +02:00
Shadowghost b1e3cf1341 Key active sessions by user to prevent session takeover 2026-08-14 14:50:06 +02:00
Shadowghost dd7de41878 Enforce EnableRemoteControlOfOtherUsers on session control 2026-08-14 14:50:06 +02:00
mbastian77 fc0af10509 Avoid unnecessary list allocation in CheckForIdlePlayback 2026-07-23 03:25:58 +02:00
Cody Robibero 6e728b009f Merge pull request #17044 from Shadowghost/version-model-and-handling
Fixes for multi version handling
2026-07-05 16:21:02 -04:00
Shadowghost 38f1d9749e Fix review comments 2026-07-02 08:49:11 +02:00
theguymadmax e26f4a1005 Fix Live TV tuner not releasing 2026-06-24 22:30:12 -04:00
Shadowghost c242533f4e Add version-aware playback tracking 2026-06-07 23:06:14 +02:00
PCEWLKR a3b2b9c07f Remove the unused NowPlayingQueueFullItems session property from session DTOs and associated references 2026-05-29 22:07:31 -04:00
jakobkukla 37350282cc Run tree-wide dotnet format 2026-05-21 20:48:41 +02:00
JPVenson c6910c3034 Update log for user session related concurrency update fails 2026-05-12 20:42:26 +00:00
Bond-009 d1ab428476 Merge pull request #16321 from WizardOfYendor1/fix/livetv-consumer-leak-negative-position-ticks
Fix live stream consumer leak on negative PositionTicks
2026-05-06 20:46:13 +02:00
JPVenson ec054f6a34 Backport changes from #15368 2026-05-05 17:57:27 +00:00
llaforest 6ea2f05497 Guard against null-overwrite of saved audio/subtitle track selections
Some clients omit AudioStreamIndex or SubtitleStreamIndex in playback progress reports and it causes previously saved track selections to be erased.
Add .HasValue checks so only explicit track changes are persisted.
2026-05-04 13:26:08 -04:00
Shadowghost d68d0fa962 Merge remote-tracking branch 'upstream/master' into perf-rebased 2026-05-03 13:31:23 +02:00
Bond-009 a183fce142 Merge branch 'master' into Preservation-of-Watched-Status-on-Re-watch 2026-04-24 19:00:19 +02:00
Shadowghost 24a0df9a39 Merge remote-tracking branch 'upstream/master' into perf-rebased 2026-04-07 21:36:07 +02:00
Patrick Cunniff 3fb1d94038 reverse check for track changed
Signed-off-by: Patrick Cunniff <pjcfifa@gmail.com>
2026-03-28 16:25:01 -04:00
WizardOfYendor1 3a4dff8cc4 Fix live stream consumer leak when PositionTicks is negative
When a stalled HLS client sends ReportPlaybackStopped with a negative
PositionTicks (e.g. HLS.js reporting position on buffer stall), the
ArgumentOutOfRangeException was thrown before GetSession was called,
causing CloseLiveStreamIfNeededAsync to never run. This left the
ILiveStream.ConsumerCount permanently incremented, permanently holding
a tuner open with no active viewer.

Fix by acquiring the session and performing live stream cleanup before
throwing the validation exception, so tuner resources are always freed
even when playback reporting fails with invalid position data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-27 20:11:26 -04:00
Shadowghost a650148dfd Merge remote-tracking branch 'upstream/master' into perf-rebased 2026-01-30 21:12:06 +01:00
nielsvanvelzen 841e4dabb5 Backport pull request #16109 from jellyfin/release-10.11.z
Fix SessionInfoWebSocketListener not using SessionInfoDto

Original-merge: e65aff8bc6

Merged-by: nielsvanvelzen <nielsvanvelzen@users.noreply.github.com>

Backported-by: Bond_009 <bond.009@outlook.com>
2026-01-28 12:11:30 -05:00
Shadowghost 5996c4afce Complete LinkedChildren integration and batch DTO optimizations
This commit integrates remaining performance changes:

- Add batch user data fetching in DtoService to reduce N+1 queries
- Add GetNextUpEpisodesBatch in TVSeriesManager for efficient batch retrieval
- Update Video/Movie/BoxSet to use LibraryManager for alternate versions
- Transition LinkedChild to use ItemId instead of Path (obsolete Path/LibraryItemId)
- Update providers and controllers for LinkedChildren-based references
- Add NextUpEpisodeBatchResult for batched episode queries
- Integrate IDescendantQueryProvider in SqliteDatabaseProvider
2026-01-18 19:48:46 +01:00
Jonathan Davies 3c77758b32 SessionManager: Improved wording of playback messages 2025-12-31 20:53:55 +00:00
Jonathan Davies b564a43d9c SessionManager: Log usernames in playback messages 2025-12-31 15:01:50 +00:00
Jonathan Davies f08657ab27 SessionManager: Log when playback is started 2025-12-31 15:01:41 +00:00
Masood 113bd9af05 Remove redundant assignment in playback start logic 2025-12-10 18:50:20 +05:30
Masood 37d6101f02 Fix watched status resetting on re-watch 2025-12-10 18:11:03 +05:30
Mason Weigand d561cef81f RemoveNowPlayingItem should also set FullNowPlayingItem to null (#14360) bb 2025-06-23 08:31:25 -06:00
Sid K 1e8bf1ce8d fix(Session): don't query DB if queue hasn't changed (#14244) 2025-06-09 17:33:28 -06:00
Mohammed Alhaddar 97f9d0c7e6 Fixing race condition in GetSessionInfo (#14131) 2025-06-06 06:55:05 -06:00
Tim Eisele 086fbd49cf Cleanup ItemFields (#13818)
* Cleanup ItemFields

* Update MediaBrowser.Model/Querying/ItemFields.cs
2025-03-31 17:46:21 -06:00
timminator 181a37a8cd Fix consumer count off by one when closing a browser tab with a livestream that is transcoding (#13220)
Rework Implementation
Fix review issues
Add missing nullorempty check
Fix closely related #13721
2025-03-27 17:59:08 -06:00
JPVenson 42bdb22bfb Fixed namespaces 2025-03-25 16:45:00 +01:00
JPVenson 160020c551 WIP fixed namespaces 2025-03-25 15:30:22 +00:00
JPVenson 850f1c79f1 Merge branch 'master' into feature/DatabaseRefactor 2025-03-25 15:12:48 +00:00
timminator 350983e03c Fix OnPlaybackStopped task erroring out (#13226) 2025-03-20 07:10:48 -06:00
JPVenson 17003f4d76 Merge remote-tracking branch 'jellyfinorigin/master' into feature/pgsql_provider 2025-02-02 02:09:14 +00:00
JPVenson aa811eb1e3 Prepared Seperation of Database components for future multi provider support 2025-01-26 20:45:28 +00:00
Josh Soref 044cf9fb85 chore: fix spelling
* a
* acceleration
* addition
* altogether
* api clients
* artist
* associated
* bandwidth
* cannot
* capabilities
* case-insensitive
* case-sensitive
* configuration
* delimiter
* dependent
* diacritics
* directors
* enable
* explicitly
* filters
* finish
* have
* hierarchy
* implicit
* include
* information
* into
* its
* keepalive
* localization
* macos
* manual
* matching
* metadata
* nonexistent
* options
* overridden
* parsed
* parser
* playback
* preferring
* processes
* processing
* provider
* ratings
* retrieval
* running
* segments
* separate
* should
* station
* subdirectories
* superseded
* supported
* system
* than
* the
* throws
* transpose
* valid
* was

link: forum or chat rooms

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2025-01-25 20:05:15 -05:00
JPVenson d81fec6b7c Backport pull request #12915 from jellyfin/release-10.10.z
Fixed possible NullReferenceException in SessionManager

Original-merge: 3592c629e7

Merged-by: crobibero <cody@robibe.ro>

Backported-by: Joshua M. Boniface <joshua@boniface.me>
2024-11-03 10:55:50 -05:00
gnattu 75bbd30296 Fix get sessions with api key (#12696) 2024-09-24 08:15:53 -06:00
Shadowghost ffa1c370fd Fix permission checks 2024-09-18 16:10:13 +02:00
Shadowghost 7a2427bf07 Add SessionInfoDto, DeviceInfoDto and implement JsonDelimitedArrayConverter.Write 2024-09-18 15:42:15 +02:00
Bond_009 eca5abe4bb Remove passwordSha1 param from AuthenticateUser function 2024-08-30 14:27:30 +02:00
gnattu 22d8528d90 Backport pull request #11901 from jellyfin/release-10.9.z
Implement Device Cache to replace EFCoreSecondLevelCacheInterceptor

Original-merge: b7bc0e1c96

Merged-by: joshuaboniface <joshua@boniface.me>

Backported-by: Bond_009 <bond.009@outlook.com>
2024-08-05 10:58:22 -04:00