using System;
using System.IO;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Model.Configuration;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
namespace Jellyfin.Server.Migrations.Routines
{
///
/// Disable transcode throttling for all installations since it is currently broken for certain video formats.
///
internal class DisableTranscodingThrottling : IMigrationRoutine
{
///
public string Name => "DisableTranscodingThrottling";
///
public void Perform(CoreAppHost host, ILogger logger)
{
// Set EnableThrottling to false since it wasn't used before and may introduce issues
var encoding = ((IConfigurationManager)host.ServerConfigurationManager).GetConfiguration("encoding");
if (encoding.EnableThrottling)
{
logger.LogInformation("Disabling transcoding throttling during migration");
encoding.EnableThrottling = false;
host.ServerConfigurationManager.SaveConfiguration("encoding", encoding);
}
}
}
}