It seems like mpv suffers from the problem documented in:
https://randomascii.wordpress.com/2013/07/08/windows-timer-resolution-megawatts-wasted/
timeBeginPeriod(1) gets called in mp_raw_time_init() on startup but timeEndPeriod(1) never gets called - not even when playback is stopped/paused.
I think a better scheme is to remove timeBeginPeriod(1) from mp_raw_time_init and add 2 more functions which get called when a stream starts playing and when a stream ends playing which gets forwarded to time(Begin|End)Period on Windows.
I don't feel particularly inclined to do anything about this. Although I wonder if we need the timer resolution at all.
@rossy opinions?
it seems windows increases timer resolution to 0.5ms while playing video using mpv, mpc-hc or vlc
timeBeginPeriod's 1ms resolution is only active while paused
so on my system timeBeginPeriod is useless
windows 10 AU
intel haswell
powercfg.exe -energy
timeBeginPeriod
timeBeginPeriod while PAUSED
without timeBeginPeriod
without timeBeginPeriod while PAUSED
Well, the timer resolution still affects the granularity of Sleep() on Windows 7 and 8.1, where the default granularity is 15.625ms. I haven't tested on 10 yet. On the other hand, timer resolution doesn't affect the granularity of QueryPerformanceCounter() and I don't think it affects when the WASAPI thread is woken by the audio subsystem or when the VO thread is woken up after VSync. It's hard to test this stuff though. There's a Java app running in the background on my PC right now that is pinning the timer frequency to 1ms.
@sda89ha9 That's strange. mpv never requests a timer frequency of 0.5ms itself, but it does activate some MMCSS profiles and apparently they can change the timer frequency, though they are not guaranteed to change it in Windows 7 and up (see https://msdn.microsoft.com/en-us/library/windows/desktop/ms684247.aspx) It could also be an audio or video driver that's making the request, which would explain why mpv, MPC-HC and VLC are affected. I can't repro on my computer (also, all the MMCSS profiles on my computer have "Clock Rate" set to 1ms.)
mpv(lachs0r) --no-audio = timer interval: 1.001 ms
mpv(lachs0r) --no-video = timer interval: 0.500 ms
mpv(no timeBeginPeriod) --no-audio = timer interval: 15.625 ms
mpv(no timeBeginPeriod) --no-video = timer interval: 0.500 ms
same results with mpc-hc, vlc, wmp
playing audio increases timer resolution to 0.5ms, while video has no effect on timer resolution
probably windows 10 bug / feature
I only see 2 places that indirectly call Sleep():
audio/out/ao_wasapi_utils.c
video/out/opengl/hwdec_dxva2egl.c
The latter one seems like it could be a problem if it sleeps as much as 16ms, though.
But what's more important is that the timer precision of SleepConditionVariable via pthread_cond_timedwait is probably influenced, which is used for non-display-sync video timing.
Potentially we could stuff timeBeginPeriod/timeEndPeriod in the same place we call the MMCSS API, but not sure if we should even care.
This is very annoying for old platform games such counter strike 1.6 , it clearly says that, the game uses a high timer, but windows 10 is forcing the audio of the game to runs 0.5 ms :/
What can i do? i have A ryzen pc, and ryzen pc doesn't perform well on old microsoft....

i have A ryzen pc, and ryzen pc doesn't perform well on old microsoft....
Have you tried running CS 1.6 via WINE on Linux?
How about using CSGO?
Have you tried to use this Windows compatibility mode setting?
What does this have to do with mpv?
I'd wager a guess.. nothing.
@haasn To be honest no :O do you think thats posible on ryzen architecture?
And if that was the case, what would be the process to run cs 1.6? what are the requirements ?
Thank you.
Because i'm tiring of have bad performance in games such counter strike 1.6 I don't know what i'm doing wrong, if something related to AMD bios in ryzen? all options seems to be in Auto, and i really don't know anything about AMD BIOS , i always use intel before, and.... to be honest in Google there is not such information that covered the whole bios in AMD or ryzen...
Try compiling mpv from source with latest ffmpeg, pretty sure it'll fix your issues.
But remember to compile mpv with --enable-cs16 😅