pango: Handle failure to multiply fractions

And set PAR back to the default value of 1:1

CID #1409851
This commit is contained in:
Edward Hervey 2017-05-26 18:02:12 +02:00 committed by Edward Hervey
parent 523e98396f
commit 62df7fdaba

View file

@ -1772,9 +1772,13 @@ gst_base_text_overlay_render_pangocairo (GstBaseTextOverlay * overlay,
break;
case GST_BASE_TEXT_OVERLAY_SCALE_MODE_DISPLAY:
/* (width * par_n) / (height * par_d) = (display_w / display_h) */
gst_util_fraction_multiply (overlay->window_width,
if (!gst_util_fraction_multiply (overlay->window_width,
overlay->window_height, overlay->height, overlay->width,
&par_n, &par_d);
&par_n, &par_d)) {
GST_WARNING_OBJECT (overlay,
"Can't figure out display ratio, defaulting to 1:1");
par_n = par_d = 1;
}
break;
case GST_BASE_TEXT_OVERLAY_SCALE_MODE_USER:
par_n = overlay->scale_par_n;