From c79649b6ec2f3df1daf75dae87af3c2323339324 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Wed, 7 Jun 2023 20:24:43 +0900 Subject: [PATCH] gst: Call priv_gst_clock_init() on DllMain Can avoid atomic read per gst_util_get_timestamp() call Part-of: --- subprojects/gstreamer/gst/gst.c | 5 ++++- subprojects/gstreamer/gst/gstutils.c | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/subprojects/gstreamer/gst/gst.c b/subprojects/gstreamer/gst/gst.c index f590b7a0a3..2ff100af0d 100644 --- a/subprojects/gstreamer/gst/gst.c +++ b/subprojects/gstreamer/gst/gst.c @@ -213,8 +213,11 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { - if (fdwReason == DLL_PROCESS_ATTACH) + if (fdwReason == DLL_PROCESS_ATTACH) { _priv_gst_dll_handle = (HMODULE) hinstDLL; + priv_gst_clock_init (); + } + return TRUE; } diff --git a/subprojects/gstreamer/gst/gstutils.c b/subprojects/gstreamer/gst/gstutils.c index 07dd4633d6..a48c72ee0f 100644 --- a/subprojects/gstreamer/gst/gstutils.c +++ b/subprojects/gstreamer/gst/gstutils.c @@ -3528,7 +3528,11 @@ gst_parse_bin_from_description_full (const gchar * bin_description, GstClockTime gst_util_get_timestamp (void) { +#if defined(G_OS_WIN32) && !defined(GST_STATIC_COMPILATION) + /* priv_gst_clock_init() is called in DllMain */ +#else priv_gst_clock_init (); +#endif return priv_gst_get_monotonic_time (); }