summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2018-09-28 12:09:16 +1000
committerMatthew Waters <matthew@centricular.com>2018-10-04 14:28:35 +1000
commit57f07fcbd442703442a10157b5662102e26f5e6b (patch)
treea4bb2448c2c3510e19861e62750561addd40156f
parentf960beaa98ddd144a8f3d1974ef0093d20a00450 (diff)
downloadgst-plugins-base-57f07fcbd442703442a10157b5662102e26f5e6b.tar.gz
gst-plugins-base-57f07fcbd442703442a10157b5662102e26f5e6b.tar.xz
glimagesink: only update the output info iff there's a valid display_rect
Attempting to use the MAX(1, display_rect) would result in the overlay composition attempting to draw into 1x1 buffer and calculate some grossly incorrect sizes. previously failing case: gltestsrc ! textoverlay text=GStreamer ! glimagesinkelement
-rw-r--r--ext/gl/gstglimagesink.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c
index 860bcfdb2..c70cd5510 100644
--- a/ext/gl/gstglimagesink.c
+++ b/ext/gl/gstglimagesink.c
@@ -1426,27 +1426,29 @@ update_output_format (GstGLImageSink * glimage_sink)
* view parity properly for line-by-line modes, because that
* depends on the window being placed correctly.
* FIXME: Should this rescaling be configurable? */
- new_w = MAX (1, glimage_sink->display_rect.w);
- new_h = MAX (1, glimage_sink->display_rect.h);
- if (new_w != out_info->width || new_h != out_info->height) {
- /* Recalculate PAR if rescaling */
- gint from_dar_n, from_dar_d;
- if (!gst_util_fraction_multiply (out_info->width, out_info->height,
- out_info->par_n, out_info->par_d, &from_dar_n,
- &from_dar_d) ||
- !gst_util_fraction_multiply (from_dar_n, from_dar_d, new_h, new_w,
- &par_n, &par_d)) {
- par_n = glimage_sink->par_n;
- par_d = glimage_sink->par_d;
+ if (glimage_sink->display_rect.w > 0 && glimage_sink->display_rect.h > 0) {
+ new_w = glimage_sink->display_rect.w;
+ new_h = glimage_sink->display_rect.h;
+ if (new_w != out_info->width || new_h != out_info->height) {
+ /* Recalculate PAR if rescaling */
+ gint from_dar_n, from_dar_d;
+ if (!gst_util_fraction_multiply (out_info->width, out_info->height,
+ out_info->par_n, out_info->par_d, &from_dar_n,
+ &from_dar_d) ||
+ !gst_util_fraction_multiply (from_dar_n, from_dar_d, new_h, new_w,
+ &par_n, &par_d)) {
+ par_n = glimage_sink->par_n;
+ par_d = glimage_sink->par_d;
+ }
+ out_info->par_n = par_n;
+ out_info->par_d = par_d;
+ out_info->width = new_w;
+ out_info->height = new_h;
}
- out_info->par_n = par_n;
- out_info->par_d = par_d;
- out_info->width = new_w;
- out_info->height = new_h;
- }
- GST_LOG_OBJECT (glimage_sink, "Set 3D output scale to %d,%d PAR %d/%d",
- out_info->width, out_info->height, out_info->par_n, out_info->par_d);
+ GST_LOG_OBJECT (glimage_sink, "Set 3D output scale to %dx%d PAR %d/%d",
+ out_info->width, out_info->height, out_info->par_n, out_info->par_d);
+ }
}
s = gst_caps_get_structure (glimage_sink->in_caps, 0);