Fix for lowered max CPU rate in media players
I was playing around with adjusting and monitoring the CPU rate on my A43, and I discovered an oddity. I have the device set to overdrive, so normally it can do 1ghz. But I noticed that inside Netflix's video player (not just the Netflix app, the video player), the CPU speed was only 800mhz and there was some stuttering. Looking more carefully, I noticed that somehow as soon as the video player started up, the maximum scaling frequency went down to 800mhz. Exit, and it goes back to 1ghz. I then found that the same happens in Youtube and the Archos Video player.
How annoying, though maybe there is some good reason for it? Is it perhaps that the video hardware can't handle the greater speed? Does anybody know?
Anyway, I have a simple fix: You just have to turn off the write permissions on /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq after the values have been all set. I don't know if any of the CPU speed utilities like SetCPU let you do this.
I fix this by setting my CPU speed settings via a script that runs on boot. (I run it via a tiny utility I wrote which I am not presently releasing, but you could also run it via Script Manager.) The script I use is:
echo conservative > scaling_governor
chmod 644 scaling_max_freq
echo 1000000 > scaling_max_freq
chmod 444 scaling_max_freq
echo 300000 > scaling_min_freq
echo 150000 > conservative/sampling_rate
echo 70 > conservative/up_threshold
The crucial line is the "chmod 444 scaling_max_freq" which sets the scaling_max_freq file to read-only. (Of course, a determined app that wants to change it can just chmod 644 scaling_max_freq and write to it. But whatever is doing the switch 800mhz isn't THAT determined.)
The result is that Star Trek plays smoothly at 1ghz in Netflix, as it should, while the built-in video player when playing lower-resolution videos uses 800mhz, as it also should.
If you have a device with a higher top speed than 1000000, just change the 1000000 to whatever your top speed is.
If you want to check if your device has the issue, start up a video, and then while the video is playing, do:
adb shell cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
If it's less than the top speed of your device, you have the issue.
But maybe it's supposed to be like that?