mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-05 15:08:48 +00:00
msdk: sink context reference
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6527>
This commit is contained in:
parent
db387f1b13
commit
6f7d62eb73
1 changed files with 13 additions and 8 deletions
|
@ -408,6 +408,7 @@ GstMsdkContext *
|
|||
gst_msdk_context_new (gboolean hardware)
|
||||
{
|
||||
GstMsdkContext *obj = g_object_new (GST_TYPE_MSDK_CONTEXT, NULL);
|
||||
gst_object_ref_sink (obj);
|
||||
|
||||
if (obj && !gst_msdk_context_open (obj, hardware)) {
|
||||
gst_object_unref (obj);
|
||||
|
@ -433,15 +434,18 @@ GstMsdkContext *
|
|||
gst_msdk_context_new_with_parent (GstMsdkContext * parent)
|
||||
{
|
||||
mfxStatus status;
|
||||
GstMsdkContext *obj = g_object_new (GST_TYPE_MSDK_CONTEXT, NULL);
|
||||
GstMsdkContextPrivate *priv = obj->priv;
|
||||
GstMsdkContextPrivate *parent_priv = parent->priv;
|
||||
GstMsdkContext *obj;
|
||||
GstMsdkContextPrivate *priv;
|
||||
GstMsdkContextPrivate *parent_priv;
|
||||
mfxVersion version;
|
||||
mfxIMPL impl;
|
||||
MsdkSession child_msdk_session;
|
||||
mfxHandleType handle_type = 0;
|
||||
mfxHDL handle = NULL, hardware_handle = NULL;
|
||||
|
||||
g_return_val_if_fail (GST_IS_MSDK_CONTEXT (parent), NULL);
|
||||
|
||||
parent_priv = parent->priv;
|
||||
status = MFXQueryIMPL (parent_priv->session.session, &impl);
|
||||
|
||||
if (status == MFX_ERR_NONE)
|
||||
|
@ -450,7 +454,6 @@ gst_msdk_context_new_with_parent (GstMsdkContext * parent)
|
|||
if (status != MFX_ERR_NONE) {
|
||||
GST_ERROR ("Failed to query the session attributes (%s)",
|
||||
msdk_status_to_string (status));
|
||||
gst_object_unref (obj);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -467,7 +470,6 @@ gst_msdk_context_new_with_parent (GstMsdkContext * parent)
|
|||
if (status != MFX_ERR_NONE || !handle) {
|
||||
GST_ERROR ("Failed to get session handle (%s)",
|
||||
msdk_status_to_string (status));
|
||||
gst_object_unref (obj);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -484,7 +486,6 @@ gst_msdk_context_new_with_parent (GstMsdkContext * parent)
|
|||
if (status != MFX_ERR_NONE) {
|
||||
GST_ERROR ("Failed to create a child mfx session (%s)",
|
||||
msdk_status_to_string (status));
|
||||
gst_object_unref (obj);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -497,7 +498,6 @@ gst_msdk_context_new_with_parent (GstMsdkContext * parent)
|
|||
GST_ERROR ("Failed to set a HW handle (%s)",
|
||||
msdk_status_to_string (status));
|
||||
MFXClose (child_msdk_session.session);
|
||||
gst_object_unref (obj);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -509,11 +509,14 @@ gst_msdk_context_new_with_parent (GstMsdkContext * parent)
|
|||
GST_ERROR ("Failed to join two sessions (%s)",
|
||||
msdk_status_to_string (status));
|
||||
MFXClose (child_msdk_session.session);
|
||||
gst_object_unref (obj);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
obj = g_object_new (GST_TYPE_MSDK_CONTEXT, NULL);
|
||||
gst_object_ref_sink (obj);
|
||||
priv = obj->priv;
|
||||
|
||||
/* Set loader to NULL for child session */
|
||||
priv->session.loader = NULL;
|
||||
priv->session.session = child_msdk_session.session;
|
||||
|
@ -549,6 +552,7 @@ gst_msdk_context_new_with_va_display (GstObject * display_obj,
|
|||
return NULL;
|
||||
|
||||
obj = g_object_new (GST_TYPE_MSDK_CONTEXT, NULL);
|
||||
gst_object_ref_sink (obj);
|
||||
|
||||
priv = obj->priv;
|
||||
priv->display = gst_object_ref (va_display);
|
||||
|
@ -599,6 +603,7 @@ gst_msdk_context_new_with_d3d11_device (GstD3D11Device * device,
|
|||
HRESULT hr;
|
||||
|
||||
obj = g_object_new (GST_TYPE_MSDK_CONTEXT, NULL);
|
||||
gst_object_ref_sink (obj);
|
||||
|
||||
priv = obj->priv;
|
||||
priv->device = gst_object_ref (device);
|
||||
|
|
Loading…
Reference in a new issue