aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server/Migrations/Routines/DisableTranscodingThrottling.cs
blob: 378e88e25b1f5bd0835e7dc67511f96e4a201772 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System;
using MediaBrowser.Common.Configuration;
using Microsoft.Extensions.Logging;

namespace Jellyfin.Server.Migrations.Routines
{
    /// <summary>
    /// Disable transcode throttling for all installations since it is currently broken for certain video formats.
    /// </summary>
    internal class DisableTranscodingThrottling : IMigrationRoutine
    {
        private readonly ILogger<DisableTranscodingThrottling> _logger;
        private readonly IConfigurationManager _configManager;

        public DisableTranscodingThrottling(ILogger<DisableTranscodingThrottling> logger, IConfigurationManager configManager)
        {
            _logger = logger;
            _configManager = configManager;
        }

        /// <inheritdoc/>
        public Guid Id => Guid.Parse("{4124C2CD-E939-4FFB-9BE9-9B311C413638}");

        /// <inheritdoc/>
        public string Name => "DisableTranscodingThrottling";

        /// <inheritdoc/>
        public bool PerformOnNewInstall => false;

        /// <inheritdoc/>
        public void Perform()
        {
            // Set EnableThrottling to false since it wasn't used before and may introduce issues
            var encoding = _configManager.GetEncodingOptions();
            if (encoding.EnableThrottling)
            {
                _logger.LogInformation("Disabling transcoding throttling during migration");
                encoding.EnableThrottling = false;

                _configManager.SaveConfiguration("encoding", encoding);
            }
        }
    }
}