diff options
author | Haihao Xiang <haihao.xiang@intel.com> | 2019-01-09 12:19:50 +0800 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2019-05-02 12:07:10 +0100 |
commit | acc536f110022bc7354acc607e4c541b5fc1e528 (patch) | |
tree | f32db80e4dc38f6cc86d043843295d977dbde221 | |
parent | 73ff734ecacbeb80b5123eff4b7aaf4c5a7a2bf8 (diff) | |
download | gstreamer-plugins-bad-acc536f110022bc7354acc607e4c541b5fc1e528.tar.gz |
msdk: check whether mfx function call fails
And log the failures for debugging
-rw-r--r-- | sys/msdk/gstmsdkcontext.c | 8 | ||||
-rw-r--r-- | sys/msdk/gstmsdkenc.c | 13 |
2 files changed, 18 insertions, 3 deletions
diff --git a/sys/msdk/gstmsdkcontext.c b/sys/msdk/gstmsdkcontext.c index e45515214..b365e22c0 100644 --- a/sys/msdk/gstmsdkcontext.c +++ b/sys/msdk/gstmsdkcontext.c @@ -308,6 +308,14 @@ gst_msdk_context_new_with_parent (GstMsdkContext * parent) if (priv->hardware) { status = MFXVideoCORE_SetHandle (priv->session, MFX_HANDLE_VA_DISPLAY, (mfxHDL) parent_priv->dpy); + + if (status != MFX_ERR_NONE) { + GST_ERROR ("Setting VA handle failed (%s)", + msdk_status_to_string (status)); + g_object_unref (obj); + return NULL; + } + } #endif diff --git a/sys/msdk/gstmsdkenc.c b/sys/msdk/gstmsdkenc.c index 7d7b5d5e9..030c9a0ea 100644 --- a/sys/msdk/gstmsdkenc.c +++ b/sys/msdk/gstmsdkenc.c @@ -340,9 +340,14 @@ gst_msdkenc_init_encoder (GstMsdkEnc * thiz) status = MFXVideoVPP_GetVideoParam (session, &thiz->vpp_param); if (status < MFX_ERR_NONE) { + mfxStatus status1; GST_ERROR_OBJECT (thiz, "Get VPP Parameters failed (%s)", msdk_status_to_string (status)); - MFXVideoVPP_Close (session); + status1 = MFXVideoVPP_Close (session); + if (status1 != MFX_ERR_NONE && status1 != MFX_ERR_NOT_INITIALIZED) + GST_WARNING_OBJECT (thiz, "VPP close failed (%s)", + msdk_status_to_string (status1)); + goto no_vpp; } else if (status > MFX_ERR_NONE) { GST_WARNING_OBJECT (thiz, "Get VPP Parameters returned: %s", @@ -665,8 +670,10 @@ gst_msdkenc_finish_frame (GstMsdkEnc * thiz, MsdkEncTask * task, * is used in MSDK samples * #define MSDK_ENC_WAIT_INTERVAL 300000 */ - MFXVideoCORE_SyncOperation (gst_msdk_context_get_session (thiz->context), - task->sync_point, 300000); + if (MFXVideoCORE_SyncOperation (gst_msdk_context_get_session (thiz->context), + task->sync_point, 300000) != MFX_ERR_NONE) + GST_WARNING_OBJECT (thiz, "failed to do sync operation"); + if (!discard && task->output_bitstream.DataLength) { GstBuffer *out_buf = NULL; guint8 *data = |