Skip to content

Commit

Permalink
Merge pull request jellyfin#12639 from gnattu/more-streambuilder-test
Browse files Browse the repository at this point in the history
  • Loading branch information
crobibero authored Sep 16, 2024
2 parents b92fc7e + ffbfd46 commit 93b40b0
Show file tree
Hide file tree
Showing 13 changed files with 1,606 additions and 757 deletions.
10 changes: 6 additions & 4 deletions MediaBrowser.Model/Dlna/StreamBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ public class StreamBuilder
{
// Aliases
internal const TranscodeReason ContainerReasons = TranscodeReason.ContainerNotSupported | TranscodeReason.ContainerBitrateExceedsLimit;
internal const TranscodeReason AudioReasons = TranscodeReason.AudioCodecNotSupported | TranscodeReason.AudioBitrateNotSupported | TranscodeReason.AudioChannelsNotSupported | TranscodeReason.AudioProfileNotSupported | TranscodeReason.AudioSampleRateNotSupported | TranscodeReason.SecondaryAudioNotSupported | TranscodeReason.AudioBitDepthNotSupported | TranscodeReason.AudioIsExternal;
internal const TranscodeReason VideoReasons = TranscodeReason.VideoCodecNotSupported | TranscodeReason.VideoResolutionNotSupported | TranscodeReason.AnamorphicVideoNotSupported | TranscodeReason.InterlacedVideoNotSupported | TranscodeReason.VideoBitDepthNotSupported | TranscodeReason.VideoBitrateNotSupported | TranscodeReason.VideoFramerateNotSupported | TranscodeReason.VideoLevelNotSupported | TranscodeReason.RefFramesNotSupported | TranscodeReason.VideoRangeTypeNotSupported | TranscodeReason.VideoProfileNotSupported;
internal const TranscodeReason AudioCodecReasons = TranscodeReason.AudioBitrateNotSupported | TranscodeReason.AudioChannelsNotSupported | TranscodeReason.AudioProfileNotSupported | TranscodeReason.AudioSampleRateNotSupported | TranscodeReason.SecondaryAudioNotSupported | TranscodeReason.AudioBitDepthNotSupported | TranscodeReason.AudioIsExternal;
internal const TranscodeReason AudioReasons = TranscodeReason.AudioCodecNotSupported | AudioCodecReasons;
internal const TranscodeReason VideoCodecReasons = TranscodeReason.VideoResolutionNotSupported | TranscodeReason.AnamorphicVideoNotSupported | TranscodeReason.InterlacedVideoNotSupported | TranscodeReason.VideoBitDepthNotSupported | TranscodeReason.VideoBitrateNotSupported | TranscodeReason.VideoFramerateNotSupported | TranscodeReason.VideoLevelNotSupported | TranscodeReason.RefFramesNotSupported | TranscodeReason.VideoRangeTypeNotSupported | TranscodeReason.VideoProfileNotSupported;
internal const TranscodeReason VideoReasons = TranscodeReason.VideoCodecNotSupported | VideoCodecReasons;
internal const TranscodeReason DirectStreamReasons = AudioReasons | TranscodeReason.ContainerNotSupported | TranscodeReason.VideoCodecTagNotSupported;

private readonly ILogger _logger;
Expand Down Expand Up @@ -1314,7 +1316,7 @@ private static int GetMaxAudioBitrateForTotalBitrate(long totalBitrate)
}
}

var rankings = new[] { VideoReasons, AudioReasons, ContainerReasons };
var rankings = new[] { TranscodeReason.VideoCodecNotSupported, VideoCodecReasons, TranscodeReason.AudioCodecNotSupported, AudioCodecReasons, ContainerReasons };
var rank = (ref TranscodeReason a) =>
{
var index = 1;
Expand Down Expand Up @@ -1417,7 +1419,7 @@ private static int GetMaxAudioBitrateForTotalBitrate(long totalBitrate)

var failureReasons = analyzedProfiles[false]
.Select(analysis => analysis.Result)
.Where(result => !containerSupported || (result.TranscodeReason & TranscodeReason.ContainerNotSupported) == 0)
.Where(result => !containerSupported || !result.TranscodeReason.HasFlag(TranscodeReason.ContainerNotSupported))
.FirstOrDefault().TranscodeReason;
if (failureReasons == 0)
{
Expand Down
220 changes: 124 additions & 96 deletions tests/Jellyfin.Model.Tests/Dlna/StreamBuilderTests.cs

Large diffs are not rendered by default.

Loading

0 comments on commit 93b40b0

Please sign in to comment.