mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-16 05:43:54 +03:00
[PR #14178] [CLOSED] Fix: Prevent premature Live TV stream closure for concurrent viewers #13871
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/jellyfin/jellyfin/pull/14178
Author: @Fahmula
Created: 5/26/2025
Status: ❌ Closed
Base:
master← Head:fix/livetv-premature-closure📝 Commits (1)
c8b3279Fix: Prevent premature Live TV stream closure for concurrent viewers📊 Changes
2 files changed (+60 additions, -9 deletions)
View changed files
📝
CONTRIBUTORS.md(+1 -0)📝
Emby.Server.Implementations/Session/SessionManager.cs(+59 -9)📄 Description
When multiple clients are watching the same Live TV channel, if one client stops their stream (e.g., closes the player, their HLS session times out, or WebSocket disconnects), the underlying M3U stream was being incorrectly closed for all remaining active viewers.
This occurred because SessionManager.CloseLiveStreamIfNeededAsync would flag the stream for closure if any associated session identifier was removed, without correctly verifying if other active client sessions (and their associated identifiers) for that same liveStreamId still existed.
This change modifies SessionManager.CloseLiveStreamIfNeededAsync to only flag the underlying live stream for closure if the activeSessionMappings collection (tracking active session identifiers for that liveStreamId) becomes completely empty after removing the current session's identifiers.
This ensures that the shared Live TV stream remains active as long as at least one client session is still actively associated with it, resolving the premature closure issue for concurrent viewers.
Issue
Fixes: #14177
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.