mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
msdk: don't reset the external frame allocator
In gst-msdk, a mfx session may be shared between different gst elements, each element tries to set the frame allocator. However, per the MSDK documation[1], the behavior is undefined if reset the frame allocator while the previous allocator is in use. Fortunately all elements use the same frame allocator, so we can avoid to call MFXVideoCORE_SetFrameAllocator again. [1]: https://software.intel.com/en-us/node/628430#MFXVideoCORE3
This commit is contained in:
parent
a0943aec69
commit
3110f3791f
4 changed files with 29 additions and 4 deletions
|
@ -75,6 +75,5 @@ gst_msdk_set_frame_allocator (GstMsdkContext * context)
|
|||
.Free = gst_msdk_frame_free,
|
||||
};
|
||||
|
||||
MFXVideoCORE_SetFrameAllocator (gst_msdk_context_get_session (context),
|
||||
&gst_msdk_frame_allocator);
|
||||
gst_msdk_context_set_frame_allocator (context, &gst_msdk_frame_allocator);
|
||||
}
|
||||
|
|
|
@ -366,8 +366,7 @@ gst_msdk_set_frame_allocator (GstMsdkContext * context)
|
|||
.Free = gst_msdk_frame_free,
|
||||
};
|
||||
|
||||
MFXVideoCORE_SetFrameAllocator (gst_msdk_context_get_session (context),
|
||||
&gst_msdk_frame_allocator);
|
||||
gst_msdk_context_set_frame_allocator (context, &gst_msdk_frame_allocator);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
|
@ -47,6 +47,7 @@ struct _GstMsdkContextPrivate
|
|||
GList *cached_alloc_responses;
|
||||
gboolean hardware;
|
||||
gboolean is_joined;
|
||||
gboolean has_frame_allocator;
|
||||
GstMsdkContextJobType job_type;
|
||||
gint shared_async_depth;
|
||||
GMutex mutex;
|
||||
|
@ -597,3 +598,25 @@ gst_msdk_context_add_shared_async_depth (GstMsdkContext * context,
|
|||
{
|
||||
context->priv->shared_async_depth += async_depth;
|
||||
}
|
||||
|
||||
void
|
||||
gst_msdk_context_set_frame_allocator (GstMsdkContext * context,
|
||||
mfxFrameAllocator * allocator)
|
||||
{
|
||||
GstMsdkContextPrivate *priv = context->priv;
|
||||
|
||||
g_mutex_lock (&priv->mutex);
|
||||
|
||||
if (!priv->has_frame_allocator) {
|
||||
mfxStatus status;
|
||||
|
||||
status = MFXVideoCORE_SetFrameAllocator (priv->session, allocator);
|
||||
|
||||
if (status != MFX_ERR_NONE)
|
||||
GST_ERROR ("Failed to set frame allocator");
|
||||
else
|
||||
priv->has_frame_allocator = 1;
|
||||
}
|
||||
|
||||
g_mutex_unlock (&priv->mutex);
|
||||
}
|
||||
|
|
|
@ -142,6 +142,10 @@ gst_msdk_context_get_shared_async_depth (GstMsdkContext * context);
|
|||
void
|
||||
gst_msdk_context_add_shared_async_depth (GstMsdkContext * context, gint async_depth);
|
||||
|
||||
void
|
||||
gst_msdk_context_set_frame_allocator (GstMsdkContext * context,
|
||||
mfxFrameAllocator * allocator);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* GST_MSDK_CONTEXT_H */
|
||||
|
|
Loading…
Reference in a new issue