PrepareSnapshotSize error : ratio=source.PrimaryVideoStream.Width / 0

ratio=source.PrimaryVideoStream.Height / 0
This commit is contained in:
jianxingwu 2020-05-15 16:58:56 +08:00
parent 59ca76cdfa
commit 74593461d4

View file

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