I have been experiencing a problem with playback latency.
When I put my machine in the power saver profile, I am not able to play a multi-channel SACD ISO without very bad stuttering, even on an 8-core / 3.1 GHz machine.
Here is a video that demonstrates the problem :
https://youtu.be/IgdYIkDaNQE . I couldn't find a way to embed it into my post.
1) First, I play in Balanced power profile. Everything is fine :
https://www.youtube.com/watch?v=IgdYIkDaNQE#t=00m01sCPU usage is in the 20-30% range and the CPU is at 3+ GHz clock.
2) Then, I play in the Power saver profile.
https://www.youtube.com/watch?v=IgdYIkDaNQE#t=01m11sThings stutter very badly. But CPU usage drops to the <10% range, and the CPU remains clocked in the 1 to 1.5 GHz range only.
You can see on top of the screen that JRiver is "buffering" during the pauses.
3) Then, I try running Prime95, a program that runs all its threads at idle priority. CPU usage goes to 100% and the CPU throttles up to 3+ GHz.
I believe there is a bug here. In the power saver mode, Media center isn't even trying to use the available CPU cycles. It's not starved for disk I/O, it's not starved for RAM, and it's not starved for CPU either. So why does the stuttering happen ?
I spent quite a while investigating this. I even used a program called IOPriority to raise the priority of all Media Center threads to the highest. This did not solve the problem, unfortunately. I think there is likely some kind of algorithm issue in the way the audio is buffered and then fed to the device.
I tried converting the specific track I was playing to DSF format. Same problem. Then I converted it to FLAC. Same problem. Then I converted it to uncompressed WAV . Same problem ! I did not expect that, since there really should be no processing at all when playing WAV.
But then I looked at the WAV file, and I saw that it was a 3.5GB WAV file. That was just one of the 16 tracks of the SACD, but it was almost as big as the entire ISO. Turns out it's still encoded in 358.2 kHz format . So that would still require sampling rate conversion to playback, which has some non-zero cost. I had my DSP studio set to convert this rate to 192 kHz. I switched to 44.1 kHz which is exactly 1/8th of 352.8 kHz . Ie. this is a much less complicated sampling rate conversion. At that point, I was able to play the uncompressed WAV file just fine at under 10% CPU without any stuttering.
I went back to the original SACD ISO, and saw the same thing, no stuttering. All other PCM sampling rates I tried that are valid to bit stream for the nVidia HDMI driver produce the stuttering. 88.2 kHz and 176.4 kHz are not supported. 44.1 kHz is the only thing that works. And it would be silly to listen to SACDs in 44.1 kHz.
I believe there is some kind of problem issue in the sampling rate conversion code that causes this latency/stuttering to happen.
Even with a more complicated conversion to 96 or 192 kHz, and in power saver profile mode, I should still have plenty of CPU cycles available. Media center somehow is not trying to use all the available cycles to complete the sampling rate conversion in time.
Even a non-realtime program that is running at idle priority like Prime95 is able to use nearly all the CPU cycles available, so, I don't think the Windows 10 OS scheduler is at fault here. Admittedly, Prime95 doesn't play audio either.
Hopefully, I have provided enough information to reproduce the bug, but if not, I'll gladly provide more, including the specific SACD ISO if it's needed.
It's been a long time since I wrote realtime audio code. I did so in assembly using interrupts and DMA on the Sound blaster on an 80286 on a Sound Blaster , and even with threads under 32-bit OS/2 in the 1990s. This involved sound mixing and sampling rate conversion, too. I'm sure the audio system in Windows is quite different than either of these. Maybe the bug is not in JRiver code and some other part of the software stack, perhaps nVidia audio driver, is at fault. Either way, I would like to know as I would like to get the fix, wherever it may need to come from.