--- a/ext/assrender/gstassrender.c
+++ b/ext/assrender/gstassrender.c
@@ -894,9 +894,18 @@ gst_ass_render_setcaps_video (GstPad * pad, GstCaps * caps)
 
   query = gst_query_new_allocation (caps, FALSE);
   if (gst_pad_peer_query (render->srcpad, query)) {
+    guint index;
+
     if (gst_query_find_allocation_meta (query,
-            GST_VIDEO_OVERLAY_COMPOSITION_META_API_TYPE, NULL))
+            GST_VIDEO_OVERLAY_COMPOSITION_META_API_TYPE, &index)) {
+      const GstStructure *params;
+
+      if (gst_query_parse_nth_allocation_meta (query, index, &params) && params) {
+        gst_structure_get_int (params, "width", &render->width);
+        gst_structure_get_int (params, "height", &render->height);
+      }
       attach = TRUE;
+    }
   }
   gst_query_unref (query);
 
