PrepareSnapshotSize repair

Former-commit-id: 0da0b0c156
This commit is contained in:
jianxingwu 2020-05-15 17:26:34 +08:00
parent bf5e732ad5
commit 2fa9255d40

View file

@ -75,7 +75,7 @@ public static Bitmap Snapshot(MediaAnalysis source, Size? size = null, TimeSpan?
{
if (size.Value.Width == 0)
{
var ratio = source.PrimaryVideoStream.Height / (double) size.Value.Height;
var ratio = (double)size.Value.Height / source.PrimaryVideoStream.Height;
size = new Size((int)(source.PrimaryVideoStream.Width * ratio),
(int)(source.PrimaryVideoStream.Height * ratio));
@ -83,7 +83,7 @@ public static Bitmap Snapshot(MediaAnalysis source, Size? size = null, TimeSpan?
if (size.Value.Height == 0)
{
var ratio = source.PrimaryVideoStream.Width / (double) size.Value.Width;
var ratio = (double)size.Value.Width / source.PrimaryVideoStream.Width;
size = new Size((int)(source.PrimaryVideoStream.Width * ratio),
(int)(source.PrimaryVideoStream.Height * ratio));