mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 05:31:15 +00:00
mediafoundation: Call MFShutdown when destroying plugin
MFStartup and MFShutdown should be paired as documented in https://docs.microsoft.com/en-us/windows/win32/api/mfapi/nf-mfapi-mfstartup#remarks Otherwise valgrind-like tools would report false positive memory leak. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1512>
This commit is contained in:
parent
9123b9ba39
commit
5ffd2c64a0
1 changed files with 17 additions and 0 deletions
|
@ -43,6 +43,12 @@ GST_DEBUG_CATEGORY (gst_mf_transform_debug);
|
|||
|
||||
#define GST_CAT_DEFAULT gst_mf_debug
|
||||
|
||||
static void
|
||||
plugin_deinit (gpointer data)
|
||||
{
|
||||
MFShutdown ();
|
||||
}
|
||||
|
||||
static gboolean
|
||||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
|
@ -85,6 +91,17 @@ plugin_init (GstPlugin * plugin)
|
|||
gst_mf_aac_enc_plugin_init (plugin, GST_RANK_SECONDARY);
|
||||
gst_mf_mp3_enc_plugin_init (plugin, GST_RANK_SECONDARY);
|
||||
|
||||
/* So that call MFShutdown() when this plugin is no more used
|
||||
* (i.e., gst_deinit). Otherwise valgrind-like tools would complain
|
||||
* about un-released media foundation resources.
|
||||
*
|
||||
* NOTE: MFStartup and MFShutdown can be called multiple times, but the number
|
||||
* of each MFStartup and MFShutdown call should be identical. This rule is
|
||||
* simliar to that of CoInitialize/CoUninitialize pair */
|
||||
g_object_set_data_full (G_OBJECT (plugin),
|
||||
"plugin-mediafoundation-shutdown", "shutdown-data",
|
||||
(GDestroyNotify) plugin_deinit);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue