msdk: Fix session close failure

In the case of multi-channels transcoding, a context with child
sesseion can be parent for others, so we need to check if the
msdkcontext has any child session in the list to avoid session
leaks. Otherwise, we will see the failure of closing a parent
session because one of its child's child session not released.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6259>
This commit is contained in:
Mengkejiergeli Ba 2024-03-01 16:12:27 +08:00 committed by GStreamer Marge Bot
parent ef5b8dc96a
commit 41c52f5739

View file

@ -376,6 +376,10 @@ gst_msdk_context_finalize (GObject * obj)
/* child sessions will be closed when the parent session is closed */
if (priv->parent_context) {
/* A context with parent_context can also be a parent to others,
* and we need to check its child_session_list */
if (priv->child_session_list)
g_list_free_full (priv->child_session_list, release_child_session);
gst_object_unref (priv->parent_context);
goto done;
} else