2015-03-15 10:50:47 -07:00
|
|
|
|
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))
|
|
|
|
|
{
|
2015-07-29 10:16:00 -07:00
|
|
|
|
profileBitrate = Math.Min(Convert.ToInt32(profileBitrate.Value * .7), 4000000);
|
2015-03-15 10:50:47 -07:00
|
|
|
|
}
|
|
|
|
|
else if (string.Equals(quality, "low", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
2015-07-29 10:16:00 -07:00
|
|
|
|
profileBitrate = Math.Min(Convert.ToInt32(profileBitrate.Value * .5), 1500000);
|
2015-03-15 10:50:47 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return profileBitrate;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|