mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-30 17:58:37 +08:00
vlc-video: Fix videos larger than 1080p being squished
Fix an overflow in display_width caused by unsafe multiplication of the video width by Sample Aspect Ratio.
This commit is contained in:
committed by
Ryan Foster
parent
e280fd6cd0
commit
5d1f0efc43
@@ -401,8 +401,8 @@ static void calculate_display_size(struct vlc_source *c, unsigned *width,
|
||||
if (track->i_type != libvlc_track_video)
|
||||
continue;
|
||||
|
||||
int display_width = track->video->i_width;
|
||||
int display_height = track->video->i_height;
|
||||
unsigned display_width = track->video->i_width;
|
||||
unsigned display_height = track->video->i_height;
|
||||
|
||||
if (display_width == 0 || display_height == 0)
|
||||
continue;
|
||||
@@ -410,9 +410,9 @@ static void calculate_display_size(struct vlc_source *c, unsigned *width,
|
||||
/* Adjust for Sample Aspect Ratio (SAR) */
|
||||
if (track->video->i_sar_num > 0 &&
|
||||
track->video->i_sar_den > 0) {
|
||||
display_width = display_width *
|
||||
track->video->i_sar_num /
|
||||
track->video->i_sar_den;
|
||||
display_width = (unsigned)util_mul_div64(
|
||||
display_width, track->video->i_sar_num,
|
||||
track->video->i_sar_den);
|
||||
}
|
||||
|
||||
switch (track->video->i_orientation) {
|
||||
|
||||
Reference in New Issue
Block a user