DisableTranscodingThrottling.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using MediaBrowser.Common.Configuration;
  3. using MediaBrowser.Model.Configuration;
  4. using Microsoft.Extensions.Logging;
  5. namespace Jellyfin.Server.Migrations.Routines
  6. {
  7. /// <summary>
  8. /// Disable transcode throttling for all installations since it is currently broken for certain video formats.
  9. /// </summary>
  10. internal class DisableTranscodingThrottling : IMigrationRoutine
  11. {
  12. private readonly ILogger<DisableTranscodingThrottling> _logger;
  13. private readonly IConfigurationManager _configManager;
  14. public DisableTranscodingThrottling(ILogger<DisableTranscodingThrottling> logger, IConfigurationManager configManager)
  15. {
  16. _logger = logger;
  17. _configManager = configManager;
  18. }
  19. /// <inheritdoc/>
  20. public Guid Id => Guid.Parse("{4124C2CD-E939-4FFB-9BE9-9B311C413638}");
  21. /// <inheritdoc/>
  22. public string Name => "DisableTranscodingThrottling";
  23. /// <inheritdoc/>
  24. public void Perform()
  25. {
  26. // Set EnableThrottling to false since it wasn't used before and may introduce issues
  27. var encoding = _configManager.GetConfiguration<EncodingOptions>("encoding");
  28. if (encoding.EnableThrottling)
  29. {
  30. _logger.LogInformation("Disabling transcoding throttling during migration");
  31. encoding.EnableThrottling = false;
  32. _configManager.SaveConfiguration("encoding", encoding);
  33. }
  34. }
  35. }
  36. }