Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Commit

Permalink
Fixed exception if Width/Height is not known in WPF's source provider.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyVignelles committed Mar 9, 2019
1 parent 3551c88 commit c916f66
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Vlc.DotNet.Wpf/VlcVideoSourceProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,16 @@ private uint VideoFormat(out IntPtr userdata, IntPtr chroma, ref uint width, ref
if (track.Type == MediaTrackTypes.Video)
{
var trackInfo = (VideoTrack)track.TrackInfo;
width = trackInfo.Width;
height = trackInfo.Height;
if (trackInfo.SarDen != 0)
if (trackInfo.Width > 0 && trackInfo.Height > 0)
{
width = width * trackInfo.SarNum / trackInfo.SarDen;
width = trackInfo.Width;
height = trackInfo.Height;
if (trackInfo.SarDen != 0)
{
width = width * trackInfo.SarNum / trackInfo.SarDen;
}
}

break;
}
}
Expand Down

0 comments on commit c916f66

Please sign in to comment.