From 41c52f57390df55ce6b205e2b9b2f84162a500f9 Mon Sep 17 00:00:00 2001 From: Mengkejiergeli Ba Date: Fri, 1 Mar 2024 16:12:27 +0800 Subject: [PATCH] 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: --- subprojects/gst-plugins-bad/sys/msdk/gstmsdkcontext.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkcontext.c b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkcontext.c index a48be65105..a8b0dd9e69 100644 --- a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkcontext.c +++ b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkcontext.c @@ -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