vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Sun Jun 18 16:49:43 2017 +0300| [5520187b0be2b5cb3081f03a483b5e22a1103b7c] | committer: Rémi Denis-Courmont
win32: gather multimedia timer initialization Fixes serialization. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5520187b0be2b5cb3081f03a483b5e22a1103b7c --- src/win32/specific.c | 19 ------------------- src/win32/thread.c | 7 ++++++- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/src/win32/specific.c b/src/win32/specific.c index aa444bf3bc..c38890febc 100644 --- a/src/win32/specific.c +++ b/src/win32/specific.c @@ -58,18 +58,8 @@ static int system_InitWSA(int hi, int lo) /** * Initializes MME timer, Winsock. */ -static HMODULE hWinmm = INVALID_HANDLE_VALUE; void system_Init(void) { - hWinmm = LoadLibrary(TEXT("winmm.dll")); - if (hWinmm) - { - MMRESULT (WINAPI * timeBeginPeriod)(UINT); - timeBeginPeriod = (void*)GetProcAddress(hWinmm, "timeBeginPeriod"); - if (timeBeginPeriod) - timeBeginPeriod(5); - } - if (system_InitWSA(2, 2) && system_InitWSA(1, 1)) fputs("Error: cannot initialize Winsocks\n", stderr); @@ -196,15 +186,6 @@ void system_Configure( libvlc_int_t *p_this, int i_argc, const char *const ppsz_ */ void system_End(void) { - if (hWinmm) - { - MMRESULT (WINAPI * timeEndPeriod)(UINT); - timeEndPeriod = (void*)GetProcAddress(hWinmm, "timeEndPeriod"); - if (timeEndPeriod) - timeEndPeriod(5); - FreeLibrary(hWinmm); - } - /* XXX: In theory, we should not call this if WSAStartup() failed. */ WSACleanup(); } diff --git a/src/win32/thread.c b/src/win32/thread.c index 9a6b6549ef..40c294dd52 100644 --- a/src/win32/thread.c +++ b/src/win32/thread.c @@ -876,8 +876,9 @@ static BOOL SelectClockSource(void *data) if (!strcmp (name, "multimedia")) { TIMECAPS caps; + MMRESULT (WINAPI * timeBeginPeriod)(UINT); - HMODULE hWinmm = GetModuleHandle(TEXT("winmm.dll")); + HMODULE hWinmm = LoadLibrary(TEXT("winmm.dll")); if (!hWinmm) goto perf; @@ -892,6 +893,10 @@ static BOOL SelectClockSource(void *data) msg_Dbg (obj, " min period: %u ms, max period: %u ms", caps.wPeriodMin, caps.wPeriodMax); mdate_selected = mdate_multimedia; + + timeBeginPeriod = (void*)GetProcAddress(hWinmm, "timeBeginPeriod"); + if (timeBeginPeriod != NULL) + timeBeginPeriod(5); } #endif else _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
