mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-24 06:30:56 +02:00
fixes #101 - FFMpeg iTunes m4a transcode issue
This commit is contained in:
parent
d2949d6e03
commit
41a63028f1
|
@ -769,26 +769,31 @@ namespace MediaBrowser.Api.Playback
|
||||||
/// <returns>System.Nullable{System.Int32}.</returns>
|
/// <returns>System.Nullable{System.Int32}.</returns>
|
||||||
private int? GetNumAudioChannelsParam(StreamRequest request, MediaStream audioStream, string outputAudioCodec)
|
private int? GetNumAudioChannelsParam(StreamRequest request, MediaStream audioStream, string outputAudioCodec)
|
||||||
{
|
{
|
||||||
if (audioStream != null)
|
var inputChannels = audioStream == null
|
||||||
{
|
? null
|
||||||
var codec = outputAudioCodec ?? string.Empty;
|
: audioStream.Channels;
|
||||||
|
|
||||||
if (audioStream.Channels > 2 && codec.IndexOf("wma", StringComparison.OrdinalIgnoreCase) != -1)
|
var codec = outputAudioCodec ?? string.Empty;
|
||||||
{
|
|
||||||
// wmav2 currently only supports two channel output
|
if (codec.IndexOf("wma", StringComparison.OrdinalIgnoreCase) != -1)
|
||||||
return 2;
|
{
|
||||||
}
|
// wmav2 currently only supports two channel output
|
||||||
|
return Math.Min(2, inputChannels ?? 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.MaxAudioChannels.HasValue)
|
if (request.MaxAudioChannels.HasValue)
|
||||||
{
|
{
|
||||||
if (audioStream != null && audioStream.Channels.HasValue)
|
if (inputChannels.HasValue)
|
||||||
{
|
{
|
||||||
return Math.Min(request.MaxAudioChannels.Value, audioStream.Channels.Value);
|
return Math.Min(request.MaxAudioChannels.Value, inputChannels.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var channelLimit = codec.IndexOf("mp3", StringComparison.OrdinalIgnoreCase) != -1
|
||||||
|
? 2
|
||||||
|
: 5;
|
||||||
|
|
||||||
// If we don't have any media info then limit it to 5 to prevent encoding errors due to asking for too many channels
|
// If we don't have any media info then limit it to 5 to prevent encoding errors due to asking for too many channels
|
||||||
return Math.Min(request.MaxAudioChannels.Value, 5);
|
return Math.Min(request.MaxAudioChannels.Value, channelLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
return request.AudioChannels;
|
return request.AudioChannels;
|
||||||
|
|
Loading…
Reference in a new issue