basetextoverlay: Fix segfault when overlay outside the frame

When the textoverlay is set outside the video frame by deltax or deltay the
calculation segfaults, but it is also  unnecessary since it doesn't need to be
displayed. So we should clip the text.

https://bugzilla.gnome.org/show_bug.cgi?id=738242
This commit is contained in:
Luis de Bethencourt 2014-10-10 10:05:19 +05:30
parent 57ac7b1800
commit 1cc311156c

View file

@ -1364,7 +1364,10 @@ gst_base_text_overlay_get_pos (GstBaseTextOverlay * overlay,
*xpos = 0; *xpos = 0;
} }
*xpos += overlay->deltax; *xpos += overlay->deltax;
if (*xpos > overlay->width) {
/* Clip text if out of frame */
overlay->silent = TRUE;
} else {
if (overlay->use_vertical_render) if (overlay->use_vertical_render)
valign = GST_BASE_TEXT_OVERLAY_VALIGN_TOP; valign = GST_BASE_TEXT_OVERLAY_VALIGN_TOP;
else else
@ -1392,6 +1395,11 @@ gst_base_text_overlay_get_pos (GstBaseTextOverlay * overlay,
break; break;
} }
*ypos += overlay->deltay; *ypos += overlay->deltay;
if (*ypos > overlay->height) {
/* Clip text if out of frame */
overlay->silent = TRUE;
}
}
} }
static inline void static inline void