Enable Throttling when transcoding without Hardware-Acceleration

This commit is contained in:
Maximilian Marschall 2020-01-12 00:31:17 +01:00
parent a272638a84
commit 081d942d03
2 changed files with 13 additions and 0 deletions

View File

@ -32,6 +32,7 @@
- [nevado](https://github.com/nevado) - [nevado](https://github.com/nevado)
- [mark-monteiro](https://github.com/mark-monteiro) - [mark-monteiro](https://github.com/mark-monteiro)
- [ullmie02](https://github.com/ullmie02) - [ullmie02](https://github.com/ullmie02)
- [geilername](https://github.com/geilername)
# Emby Contributors # Emby Contributors

View File

@ -327,6 +327,18 @@ namespace MediaBrowser.Api.Playback
private bool EnableThrottling(StreamState state) 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; return false;
//// do not use throttling with hardware encoders //// do not use throttling with hardware encoders
//return state.InputProtocol == MediaProtocol.File && //return state.InputProtocol == MediaProtocol.File &&