aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Sync/SyncHelper.cs
blob: b6242950ff9f12368c6278651c30369ccfe8e1b8 (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
using System;

namespace MediaBrowser.Server.Implementations.Sync
{
    public class SyncHelper
    {
        public static int? AdjustBitrate(int? profileBitrate, string quality)
        {
            if (profileBitrate.HasValue)
            {
                if (string.Equals(quality, "medium", StringComparison.OrdinalIgnoreCase))
                {
                    profileBitrate = Math.Min(Convert.ToInt32(profileBitrate.Value * .7), 4000000);
                }
                else if (string.Equals(quality, "low", StringComparison.OrdinalIgnoreCase))
                {
                    profileBitrate = Math.Min(Convert.ToInt32(profileBitrate.Value * .5), 1500000);
                }
            }

            return profileBitrate;
        }
    }
}