From: Seungha Yang Date: Fri, 5 Aug 2022 19:57:49 +0000 (+0900) Subject: d3d11device: Use WIN32 critical section API directly X-Git-Tag: 1.22.0~1150 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cf64c9f58847a1da8bf54d7c2f4d18dcd87e1f38;p=platform%2Fupstream%2Fgstreamer.git d3d11device: Use WIN32 critical section API directly GLib's GRecMutex will allocate another heap memory for CRITICAL_SECTION struct and g_rec_mutex_lock/g_rec_mutex_unlock use WIN32 APIs actually. We don't need such intermediate function calls and redundant heap allocation. Just call WIN32 APIs directly. Part-of: --- diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11device.cpp b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11device.cpp index 41d4f0e..1b2daa3 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11device.cpp +++ b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11device.cpp @@ -115,7 +115,7 @@ struct _GstD3D11DevicePrivate IDXGIFactory1 *factory; GArray *format_table; - GRecMutex extern_lock; + CRITICAL_SECTION extern_lock; GMutex resource_lock; LARGE_INTEGER frequency; @@ -420,7 +420,7 @@ gst_d3d11_device_init (GstD3D11Device * self) priv->format_table = g_array_sized_new (FALSE, FALSE, sizeof (GstD3D11Format), GST_D3D11_N_FORMATS); - g_rec_mutex_init (&priv->extern_lock); + InitializeCriticalSection (&priv->extern_lock); g_mutex_init (&priv->resource_lock); self->priv = priv; @@ -752,7 +752,7 @@ gst_d3d11_device_finalize (GObject * object) GST_LOG_OBJECT (self, "finalize"); g_array_unref (priv->format_table); - g_rec_mutex_clear (&priv->extern_lock); + DeleteCriticalSection (&priv->extern_lock); g_mutex_clear (&priv->resource_lock); g_free (priv->description); @@ -1334,7 +1334,7 @@ gst_d3d11_device_lock (GstD3D11Device * device) priv = device->priv; GST_TRACE_OBJECT (device, "device locking"); - g_rec_mutex_lock (&priv->extern_lock); + EnterCriticalSection (&priv->extern_lock); GST_TRACE_OBJECT (device, "device locked"); } @@ -1356,7 +1356,7 @@ gst_d3d11_device_unlock (GstD3D11Device * device) priv = device->priv; - g_rec_mutex_unlock (&priv->extern_lock); + LeaveCriticalSection (&priv->extern_lock); GST_TRACE_OBJECT (device, "device unlocked"); }