aboutsummaryrefslogtreecommitdiff
path: root/tests/Jellyfin.MediaEncoding.Tests/Probing
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2025-04-19 21:08:29 +0200
committerGitHub <noreply@github.com>2025-04-19 13:08:29 -0600
commit74230131a199e33894cf1778cee3579cd3c75011 (patch)
treec346c8123118c58e161992c57f6cc73ae9bd67b0 /tests/Jellyfin.MediaEncoding.Tests/Probing
parent7df6e0b16f8e6b3026955e31417906b3bcbba290 (diff)
Fix OverflowException when scanning media with a very short duration (#13949)
Diffstat (limited to 'tests/Jellyfin.MediaEncoding.Tests/Probing')
-rw-r--r--tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs b/tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs
index df51d39cb7..94710a0957 100644
--- a/tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs
+++ b/tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs
@@ -289,6 +289,40 @@ namespace Jellyfin.MediaEncoding.Tests.Probing
}
[Fact]
+ public void GetMediaInfo_VideoWithSingleFrameMjpeg_Success()
+ {
+ var bytes = File.ReadAllBytes("Test Data/Probing/video_single_frame_mjpeg.json");
+
+ var internalMediaInfoResult = JsonSerializer.Deserialize<InternalMediaInfoResult>(bytes, _jsonOptions);
+ MediaInfo res = _probeResultNormalizer.GetMediaInfo(internalMediaInfoResult, VideoType.VideoFile, false, "Test Data/Probing/video_interlaced.mp4", MediaProtocol.File);
+
+ Assert.Equal(3, res.MediaStreams.Count);
+
+ Assert.NotNull(res.VideoStream);
+ Assert.Equal(res.MediaStreams[0], res.VideoStream);
+ Assert.Equal(0, res.VideoStream.Index);
+ Assert.Equal("h264", res.VideoStream.Codec);
+ Assert.Equal("High", res.VideoStream.Profile);
+ Assert.Equal(MediaStreamType.Video, res.VideoStream.Type);
+ Assert.Equal(1080, res.VideoStream.Height);
+ Assert.Equal(1920, res.VideoStream.Width);
+ Assert.False(res.VideoStream.IsInterlaced);
+ Assert.Equal("16:9", res.VideoStream.AspectRatio);
+ Assert.Equal("yuv420p", res.VideoStream.PixelFormat);
+ Assert.Equal(42d, res.VideoStream.Level);
+ Assert.Equal(1, res.VideoStream.RefFrames);
+ Assert.True(res.VideoStream.IsAVC);
+ Assert.Equal(50f, res.VideoStream.RealFrameRate);
+ Assert.Equal("1/1000", res.VideoStream.TimeBase);
+ Assert.Equal(8, res.VideoStream.BitDepth);
+ Assert.True(res.VideoStream.IsDefault);
+
+ var mjpeg = res.MediaStreams[2];
+ Assert.NotNull(mjpeg);
+ Assert.Equal("mjpeg", mjpeg.Codec);
+ }
+
+ [Fact]
public void GetMediaInfo_MusicVideo_Success()
{
var bytes = File.ReadAllBytes("Test Data/Probing/music_video_metadata.json");