From 081d942d0361a4ad8aa918edcbb2f20c4c3f8471 Mon Sep 17 00:00:00 2001 From: Maximilian Marschall Date: Sun, 12 Jan 2020 00:31:17 +0100 Subject: Enable Throttling when transcoding without Hardware-Acceleration --- MediaBrowser.Api/Playback/BaseStreamingService.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'MediaBrowser.Api/Playback/BaseStreamingService.cs') diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index 5881e22a7..023d373d5 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -327,6 +327,18 @@ namespace MediaBrowser.Api.Playback private bool EnableThrottling(StreamState state) { + var encodingOptions = ServerConfigurationManager.GetEncodingOptions(); + + // enable throttling when not using hardware acceleration + if (encodingOptions.HardwareAccelerationType == string.Empty) + { + return state.InputProtocol == MediaProtocol.File && + state.RunTimeTicks.HasValue && + state.RunTimeTicks.Value >= TimeSpan.FromMinutes(5).Ticks && + state.IsInputVideo && + state.VideoType == VideoType.VideoFile && + !string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase); + } return false; //// do not use throttling with hardware encoders //return state.InputProtocol == MediaProtocol.File && -- cgit v1.2.3 From a26c1ab17dd0bb4c7cefa9130c19128a08a57aee Mon Sep 17 00:00:00 2001 From: Vasily Date: Wed, 12 Feb 2020 14:19:11 +0300 Subject: Remove commented code --- MediaBrowser.Api/Playback/BaseStreamingService.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'MediaBrowser.Api/Playback/BaseStreamingService.cs') diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index 43e837446..7837aa65b 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -329,7 +329,7 @@ namespace MediaBrowser.Api.Playback { var encodingOptions = ServerConfigurationManager.GetEncodingOptions(); - // enable throttling when not using hardware acceleration + // enable throttling when NOT using hardware acceleration if (encodingOptions.HardwareAccelerationType == string.Empty) { return state.InputProtocol == MediaProtocol.File && @@ -340,14 +340,6 @@ namespace MediaBrowser.Api.Playback !string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase); } return false; - //// do not use throttling with hardware encoders - //return state.InputProtocol == MediaProtocol.File && - // state.RunTimeTicks.HasValue && - // state.RunTimeTicks.Value >= TimeSpan.FromMinutes(5).Ticks && - // state.IsInputVideo && - // state.VideoType == VideoType.VideoFile && - // !string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase) && - // string.Equals(GetVideoEncoder(state), "libx264", StringComparison.OrdinalIgnoreCase); } /// -- cgit v1.2.3