Close live stream on session end

This commit is contained in:
Cody Robibero
2022-05-27 15:58:31 -06:00
parent 8a6b26cd42
commit bf0a7c374c
3 changed files with 8 additions and 4 deletions

View File

@@ -329,13 +329,17 @@ namespace Emby.Server.Implementations.Session
}
/// <inheritdoc />
public void CloseIfNeeded(SessionInfo session)
public async Task CloseIfNeededAsync(SessionInfo session)
{
if (!session.SessionControllers.Any(i => i.IsSessionActive))
{
var key = GetSessionKey(session.Client, session.DeviceId);
_activeConnections.TryRemove(key, out _);
if (!string.IsNullOrEmpty(session.PlayState?.LiveStreamId))
{
await _mediaSourceManager.CloseLiveStream(session.PlayState?.LiveStreamId).ConfigureAwait(false);
}
OnSessionEnded(session);
}