summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorU. Artie Eoff <ullysses.a.eoff@intel.com>2019-08-30 14:14:30 -0700
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2019-09-05 11:03:34 +0000
commitc6ee20fab319a92a71a9fecf10703f1d211e3fba (patch)
tree9a52fa61eee4433a3072b08231350d809eb0266c
parent9fd020a1177160f5368e62e58daf8194a936eb3a (diff)
vaapipostproc: fix output buffer WxH for crop meta forwarding
Adding crop meta x,y to w,h only compensates for left,top cropping. But we also need to compensate for right,bottom cropping. The video meta contains the appropriate w,h (uncropped) values, so use it instead. Test: gst-launch-1.0 -vf videotestsrc num-buffers=500 \ ! videocrop top=50 bottom=30 left=40 right=20 \ ! vaapipostproc ! vaapisink & \ gst-launch-1.0 -vf videotestsrc num-buffers=500 \ ! videocrop top=50 bottom=30 left=40 right=20 \ ! vaapipostproc ! identity drop-allocation=1 \ ! vaapisink
-rw-r--r--gst/vaapi/gstvaapipostproc.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/gst/vaapi/gstvaapipostproc.c b/gst/vaapi/gstvaapipostproc.c
index b115de01..724cf978 100644
--- a/gst/vaapi/gstvaapipostproc.c
+++ b/gst/vaapi/gstvaapipostproc.c
@@ -1443,7 +1443,7 @@ gst_vaapipostproc_prepare_output_buffer (GstBaseTransform * trans,
GstBuffer * inbuf, GstBuffer ** outbuf_ptr)
{
GstVaapiPostproc *const postproc = GST_VAAPIPOSTPROC (trans);
- const GstVideoCropMeta *crop_meta;
+ const GstVideoMeta *video_meta;
GstVideoInfo info;
if (gst_base_transform_is_passthrough (trans)) {
@@ -1453,11 +1453,17 @@ gst_vaapipostproc_prepare_output_buffer (GstBaseTransform * trans,
/* If we are not using vpp crop (i.e. forwarding crop meta to downstream)
* then, ensure our output buffer pool is sized for uncropped output */
- crop_meta = gst_buffer_get_video_crop_meta (inbuf);
- if (crop_meta && !use_vpp_crop (postproc)) {
+ if (gst_buffer_get_video_crop_meta (inbuf) && !use_vpp_crop (postproc)) {
+ /* The video meta is required since the caps width/height are smaller,
+ * which would not result in a usable GstVideoInfo for mapping the
+ * buffer. */
+ video_meta = gst_buffer_get_video_meta (inbuf);
+ if (!video_meta)
+ return GST_FLOW_ERROR;
+
info = postproc->srcpad_info;
- info.width += crop_meta->x;
- info.height += crop_meta->y;
+ info.width = video_meta->width;
+ info.height = video_meta->height;
ensure_buffer_pool (postproc, &info);
}