fixes #1310 - Downscaling 1280x720 to 720x404
This commit is contained in:
parent
f9804ce6d1
commit
2841eba202
|
@ -1623,7 +1623,10 @@ namespace MediaBrowser.Api.Playback
|
||||||
|
|
||||||
if (state.OutputVideoBitrate.HasValue)
|
if (state.OutputVideoBitrate.HasValue)
|
||||||
{
|
{
|
||||||
var resolution = ResolutionNormalizer.Normalize(state.OutputVideoBitrate.Value,
|
var resolution = ResolutionNormalizer.Normalize(
|
||||||
|
state.VideoStream == null ? (int?)null : state.VideoStream.BitRate,
|
||||||
|
state.OutputVideoBitrate.Value,
|
||||||
|
state.VideoStream == null ? null : state.VideoStream.Codec,
|
||||||
state.OutputVideoCodec,
|
state.OutputVideoCodec,
|
||||||
videoRequest.MaxWidth,
|
videoRequest.MaxWidth,
|
||||||
videoRequest.MaxHeight);
|
videoRequest.MaxHeight);
|
||||||
|
|
|
@ -82,7 +82,10 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
|
|
||||||
if (state.OutputVideoBitrate.HasValue)
|
if (state.OutputVideoBitrate.HasValue)
|
||||||
{
|
{
|
||||||
var resolution = ResolutionNormalizer.Normalize(state.OutputVideoBitrate.Value,
|
var resolution = ResolutionNormalizer.Normalize(
|
||||||
|
state.VideoStream == null ? (int?)null : state.VideoStream.BitRate,
|
||||||
|
state.OutputVideoBitrate.Value,
|
||||||
|
state.VideoStream == null ? null : state.VideoStream.Codec,
|
||||||
state.OutputVideoCodec,
|
state.OutputVideoCodec,
|
||||||
request.MaxWidth,
|
request.MaxWidth,
|
||||||
request.MaxHeight);
|
request.MaxHeight);
|
||||||
|
|
|
@ -14,14 +14,29 @@ namespace MediaBrowser.Model.Dlna
|
||||||
new ResolutionConfiguration(1280, 2500000)
|
new ResolutionConfiguration(1280, 2500000)
|
||||||
};
|
};
|
||||||
|
|
||||||
public static ResolutionOptions Normalize(int maxBitrate,
|
public static ResolutionOptions Normalize(int? inputBitrate,
|
||||||
string codec,
|
int outputBitrate,
|
||||||
|
string inputCodec,
|
||||||
|
string outputCodec,
|
||||||
int? maxWidth,
|
int? maxWidth,
|
||||||
int? maxHeight)
|
int? maxHeight)
|
||||||
{
|
{
|
||||||
foreach (var config in Configurations)
|
// If the bitrate isn't changing, then don't downlscale the resolution
|
||||||
|
if (inputBitrate.HasValue && outputBitrate >= inputBitrate.Value)
|
||||||
|
{
|
||||||
|
if (maxWidth.HasValue || maxHeight.HasValue)
|
||||||
|
{
|
||||||
|
return new ResolutionOptions
|
||||||
|
{
|
||||||
|
MaxWidth = maxWidth,
|
||||||
|
MaxHeight = maxHeight
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var config in Configurations)
|
||||||
{
|
{
|
||||||
if (maxBitrate <= config.MaxBitrate)
|
if (outputBitrate <= config.MaxBitrate)
|
||||||
{
|
{
|
||||||
var originvalValue = maxWidth;
|
var originvalValue = maxWidth;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user