[PR #14178] [CLOSED] Fix: Prevent premature Live TV stream closure for concurrent viewers #13871

Closed
opened 2026-02-07 07:20:31 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/jellyfin/jellyfin/pull/14178
Author: @Fahmula
Created: 5/26/2025
Status: Closed

Base: masterHead: fix/livetv-premature-closure


📝 Commits (1)

  • c8b3279 Fix: 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.

## 📋 Pull Request Information **Original PR:** https://github.com/jellyfin/jellyfin/pull/14178 **Author:** [@Fahmula](https://github.com/Fahmula) **Created:** 5/26/2025 **Status:** ❌ Closed **Base:** `master` ← **Head:** `fix/livetv-premature-closure` --- ### 📝 Commits (1) - [`c8b3279`](https://github.com/jellyfin/jellyfin/commit/c8b327914d2b48c16485e1a34d73016db974c71b) Fix: Prevent premature Live TV stream closure for concurrent viewers ### 📊 Changes **2 files changed** (+60 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `CONTRIBUTORS.md` (+1 -0) 📝 `Emby.Server.Implementations/Session/SessionManager.cs` (+59 -9) </details> ### 📄 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-07 07:20:31 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#13871