summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaihao Xiang <haihao.xiang@intel.com>2019-02-27 08:07:29 +0800
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2019-02-28 11:08:24 +0000
commit18d410b81a5d18703c19898dd5d8ec132c6bbb5a (patch)
tree3994c85d7cfe699eb94255175926c49bae9f02b8
parent03fcdedd66d82352a87002d402701b59f6e56b1f (diff)
msdkdec: fix for resolution change
Returning MFX_ERR_INCOMPATIBLE_VIDEO_PARAM from MFXVideoDECODE_DecodeFrameAsync means the allocated mfx surface is not suitable for the current frame, we need a new mfx surface and try MFXVideoDECODE_DecodeFrameAsync again.
-rw-r--r--sys/msdk/gstmsdkdec.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/sys/msdk/gstmsdkdec.c b/sys/msdk/gstmsdkdec.c
index ac2c4e0ed..8625e0b81 100644
--- a/sys/msdk/gstmsdkdec.c
+++ b/sys/msdk/gstmsdkdec.c
@@ -1001,12 +1001,24 @@ gst_msdkdec_handle_frame (GstVideoDecoder * decoder, GstVideoCodecFrame * frame)
/* media-sdk requires complete reset since the surface is inadaquate to
* do further decoding */
if (status == MFX_ERR_INCOMPATIBLE_VIDEO_PARAM) {
+ /* MFX_ERR_INCOMPATIBLE_VIDEO_PARAM means the current mfx surface is not
+ * suitable for the current frame, call MFXVideoDECODE_DecodeHeader to get
+ * the current frame size then do memory re-allocation, otherwise
+ * MFXVideoDECODE_DecodeFrameAsync still will fail for next call */
+ status = MFXVideoDECODE_DecodeHeader (session, &bitstream, &thiz->param);
+ if (status == MFX_ERR_MORE_DATA) {
+ flow = GST_FLOW_OK;
+ goto done;
+ }
+
/* Requires memory re-allocation, do a hard reset */
if (!gst_msdkdec_negotiate (thiz, TRUE))
goto error;
- status =
- MFXVideoDECODE_DecodeFrameAsync (session, &bitstream,
- surface->surface, &task->surface, &task->sync_point);
+
+ /* The current surface is freed when doing a hard reset, a new surface is
+ * required for the new resolution */
+ surface = NULL;
+ continue;
}
if (G_LIKELY (status == MFX_ERR_NONE)