summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>2016-09-07 17:34:08 +0200
committerVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>2016-09-08 17:06:57 +0200
commit574ff693a5eedf79f1e012654b6d08af486972fb (patch)
treed6927c2dda8e47eb79fda1aa1bea96f9aa5ce444
parentc67edea4aba35f16d9e97c78a0b49ad1b590b112 (diff)
libs: surface: ensure composite overlay is not bigger
Ensure the composition overlay rectangle (subtitles) is not bigger than the surface where it is going to be composited and rendered. https://bugzilla.gnome.org/show_bug.cgi?id=766978
-rw-r--r--gst-libs/gst/vaapi/gstvaapisurface.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapisurface.c b/gst-libs/gst/vaapi/gstvaapisurface.c
index 07f8a292..4ef616ee 100644
--- a/gst-libs/gst/vaapi/gstvaapisurface.c
+++ b/gst-libs/gst/vaapi/gstvaapisurface.c
@@ -1016,6 +1016,10 @@ gst_vaapi_surface_set_subpictures_from_composition (GstVaapiSurface * surface,
(gint *) & sub_rect.x, (gint *) & sub_rect.y,
&sub_rect.width, &sub_rect.height);
+ /* ensure that the overlay is not bigger than the surface */
+ sub_rect.y = MIN (sub_rect.y, surface->height);
+ sub_rect.width = MIN (sub_rect.width, surface->width);
+
if (!gst_vaapi_surface_associate_subpicture (surface, subpicture,
NULL, &sub_rect)) {
GST_WARNING ("could not render overlay rectangle %p", rect);