mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-27 02:56:54 +01:00
Merge pull request #16321 from WizardOfYendor1/fix/livetv-consumer-leak-negative-position-ticks
Fix live stream consumer leak on negative PositionTicks
This commit is contained in:
@@ -1021,15 +1021,22 @@ namespace Emby.Server.Implementations.Session
|
||||
|
||||
ArgumentNullException.ThrowIfNull(info);
|
||||
|
||||
if (info.PositionTicks.HasValue && info.PositionTicks.Value < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(info), "The PlaybackStopInfo's PositionTicks was negative.");
|
||||
}
|
||||
|
||||
var session = GetSession(info.SessionId);
|
||||
|
||||
session.StopAutomaticProgress();
|
||||
|
||||
if (info.PositionTicks.HasValue && info.PositionTicks.Value < 0)
|
||||
{
|
||||
// Ensure live stream is cleaned up before throwing, to prevent tuner
|
||||
// resource leaks when stalled clients report a negative PositionTicks.
|
||||
if (!string.IsNullOrEmpty(info.LiveStreamId))
|
||||
{
|
||||
await CloseLiveStreamIfNeededAsync(info.LiveStreamId, session.Id).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
throw new ArgumentOutOfRangeException(nameof(info), "The PlaybackStopInfo's PositionTicks was negative.");
|
||||
}
|
||||
|
||||
var libraryItem = info.ItemId.IsEmpty()
|
||||
? null
|
||||
: GetNowPlayingItem(session, info.ItemId);
|
||||
|
||||
Reference in New Issue
Block a user