CPU tuning issues with WPF

I am working on an application in WPF using Vlc.DotNet. I am having a problem playing videos at a terrible frame rate on my laptop.

After some research, I found that the issue was CPU throttling. If the laptop's power profile is in BatterySaver mode, it has a problem. If I switch it to performance, everything is fine. It seems to me that in BatterySaver mode, it allows the CPU to throttle and for some reason doesn't throttle properly when the application needs it. Is there anyway I can fix this problem?

I tried to prioritize with the code below and it didn't seem to change the situation.

System.Diagnostics.Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;


Vlc.DotNet and ImageSource updates with the following image displayed. I have this source related to an image on a GUI that displays it. I've used the WPF Performance suite and can see what's going on, but not why. As soon as it starts playing, AKA refreshes the image in the GUI at 30 frames per second, the frame rate of the whole application drops to about 5 frames per second.


source to share

1 answer

Have you tried switching to rendering software to avoid the CPU bottleneck? I know WPF uses a separate thread for rendering and I'm not sure if you can even access it from Process.Threads. What I have done in the past is attaching to a power off mode and dynamically switching the mode like this , so changing the power mode does not switch to hardware rendering. Not sure if this will work as I don't understand what your specific bottleneck is, but hopefully this indicates that you are in a good direction.



All Articles