msdkdec: Check width and height of mfxVideoParam before allocation
authorMengkejiergeli Ba <mengkejiergeli.ba@intel.com>
Wed, 26 Jan 2022 06:55:51 +0000 (14:55 +0800)
committerHaihao Xiang <haihao.xiang@intel.com>
Tue, 22 Mar 2022 05:22:09 +0000 (05:22 +0000)
DecodeHeader must be called to fill the mfxVideoParam before allocation,
and thus the check for width and height in mfxVideoParam is necessary.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1817>

subprojects/gst-plugins-bad/sys/msdk/gstmsdkdec.c

index 291a42e..8700d6e 100644 (file)
@@ -1675,6 +1675,9 @@ gst_msdkdec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
   GstCaps *pool_caps /*, *negotiated_caps */ ;
   guint size, min_buffers, max_buffers;
 
+  if (!thiz->param.mfx.FrameInfo.Width || !thiz->param.mfx.FrameInfo.Height)
+    return FALSE;
+
   if (!GST_VIDEO_DECODER_CLASS (parent_class)->decide_allocation (decoder,
           query))
     return FALSE;