gst: Call priv_gst_clock_init() on DllMain

Can avoid atomic read per gst_util_get_timestamp() call

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4794>
This commit is contained in:
Seungha Yang 2023-06-07 20:24:43 +09:00 committed by GStreamer Marge Bot
parent b291efe44b
commit c79649b6ec
2 changed files with 8 additions and 1 deletions

View file

@ -213,8 +213,11 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
BOOL WINAPI BOOL WINAPI
DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) 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_dll_handle = (HMODULE) hinstDLL;
priv_gst_clock_init ();
}
return TRUE; return TRUE;
} }

View file

@ -3528,7 +3528,11 @@ gst_parse_bin_from_description_full (const gchar * bin_description,
GstClockTime GstClockTime
gst_util_get_timestamp (void) 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 (); priv_gst_clock_init ();
#endif
return priv_gst_get_monotonic_time (); return priv_gst_get_monotonic_time ();
} }