msdk: check GstMsdkContext instead of mfxSession instance
authorHaihao Xiang <haihao.xiang@intel.com>
Thu, 10 Dec 2020 03:11:04 +0000 (11:11 +0800)
committerHaihao Xiang <haihao.xiang@intel.com>
Thu, 24 Dec 2020 02:53:13 +0000 (02:53 +0000)
commit86fdd39147a9cc19070954fd46d8814cad37f35a
tree0b99cce0f0fedfc550954e1371caefb760ad9768
parent1138c798ffa6d9b500393cc537db60b805b36e59
msdk: check GstMsdkContext instead of mfxSession instance

When creating a GstMsdkContext instance, it also creates a mfxSession
instance, so we may check GstMsdkContext instead of mfxSession instance
to make sure MSDK is available. In addition, according to MSDK doc [1],
MFXVideoCORE_SetHandle function should be executed before any actual
usage of library including queries, otherwise the behavior is
unexpected, so we should call MFXVideoCORE_QueryPlatform after
MFXVideoCORE_SetHandle on Linux

[1] https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#working-with-va-api-applications

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1867>
sys/msdk/gstmsdkcontext.c
sys/msdk/msdk.c