Remove debug logging from stream limit checks

This commit is contained in:
Mahmoud Almontasser 2025-08-03 21:15:53 +02:00
parent 944a17137e
commit 0abcbb82d6

View File

@ -303,22 +303,18 @@ public class DynamicHlsController : BaseJellyfinApiController
.ConfigureAwait(false);
// Check video stream limits before starting transcoding
_logger.LogInformation("DEBUG: state.IsOutputVideo = {IsOutputVideo}", state.IsOutputVideo);
if (state.IsOutputVideo)
{
var userId = HttpContext.User.GetUserId();
_logger.LogInformation("DEBUG: userId = {UserId}", userId);
if (!userId.IsEmpty())
{
var user = _userManager.GetUserById(userId);
_logger.LogInformation("DEBUG: user = {User}, MaxActiveVideoStreams = {MaxActiveVideoStreams}", user?.Username, user?.MaxActiveVideoStreams);
if (user is not null && user.MaxActiveVideoStreams > 0)
{
var activeVideoStreams = _sessionManager.Sessions.Count(s =>
s.UserId.Equals(user.Id) &&
s.NowPlayingItem?.MediaType == MediaType.Video);
_logger.LogInformation("Current/Max video streams for user {User}: {VideoStreams}/{MaxVideoStreams}", user.Username, activeVideoStreams, user.MaxActiveVideoStreams);
if (activeVideoStreams >= user.MaxActiveVideoStreams)
{
throw new MediaBrowser.Controller.Net.SecurityException($"User '{user.Username}' has reached their maximum number of concurrent video streams ({user.MaxActiveVideoStreams}).");
@ -553,20 +549,16 @@ public class DynamicHlsController : BaseJellyfinApiController
};
// Check video stream limits before starting transcoding
_logger.LogInformation("DEBUG: GetMasterHlsVideoPlaylist called");
var userId = HttpContext.User.GetUserId();
_logger.LogInformation("DEBUG: userId = {UserId}", userId);
if (!userId.IsEmpty())
{
var user = _userManager.GetUserById(userId);
_logger.LogInformation("DEBUG: user = {User}, MaxActiveVideoStreams = {MaxActiveVideoStreams}", user?.Username, user?.MaxActiveVideoStreams);
if (user is not null && user.MaxActiveVideoStreams > 0)
{
var activeVideoStreams = _sessionManager.Sessions.Count(s =>
s.UserId.Equals(user.Id) &&
s.NowPlayingItem?.MediaType == MediaType.Video);
_logger.LogInformation("Current/Max video streams for user {User}: {VideoStreams}/{MaxVideoStreams}", user.Username, activeVideoStreams, user.MaxActiveVideoStreams);
if (activeVideoStreams >= user.MaxActiveVideoStreams)
{
throw new MediaBrowser.Controller.Net.SecurityException($"User '{user.Username}' has reached their maximum number of concurrent video streams ({user.MaxActiveVideoStreams}).");
@ -918,20 +910,16 @@ public class DynamicHlsController : BaseJellyfinApiController
};
// Check video stream limits before starting transcoding
_logger.LogInformation("DEBUG: GetVariantHlsVideoPlaylist called");
var userId = HttpContext.User.GetUserId();
_logger.LogInformation("DEBUG: userId = {UserId}", userId);
if (!userId.IsEmpty())
{
var user = _userManager.GetUserById(userId);
_logger.LogInformation("DEBUG: user = {User}, MaxActiveVideoStreams = {MaxActiveVideoStreams}", user?.Username, user?.MaxActiveVideoStreams);
if (user is not null && user.MaxActiveVideoStreams > 0)
{
var activeVideoStreams = _sessionManager.Sessions.Count(s =>
s.UserId.Equals(user.Id) &&
s.NowPlayingItem?.MediaType == MediaType.Video);
_logger.LogInformation("Current/Max video streams for user {User}: {VideoStreams}/{MaxVideoStreams}", user.Username, activeVideoStreams, user.MaxActiveVideoStreams);
if (activeVideoStreams >= user.MaxActiveVideoStreams)
{
throw new MediaBrowser.Controller.Net.SecurityException($"User '{user.Username}' has reached their maximum number of concurrent video streams ({user.MaxActiveVideoStreams}).");