INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Prevent sound breaks during 100% CPU load  (Read 2047 times)

mikolajek

  • Recent member
  • *
  • Posts: 48
Prevent sound breaks during 100% CPU load
« on: April 01, 2019, 03:00:13 pm »

I'm running XPS laptop with i7-8500U processor, which I believed would be sufficient for office work and music playback. Unfortunately in short moments when my CPU loads jump to 100%, JRiver playback gets interrupted for a moment. Strangely enough it looks Chrome is the main culprit, the other apps are not that invasive. A typical scenario is that I click a link to open a page in the new tab, the tab opens, the CPU spikes for a second to 100% utilization, and Media Center gets choked.

I've tried increasing Media Center app and service priority in Windows, increasing ASIO buffer, increasing preload buffer, but nothing has helped so far. Any advice so I could get rid of this issue?
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72545
  • Where did I put my teeth?
Re: Prevent sound breaks during 100% CPU load
« Reply #1 on: April 01, 2019, 03:38:08 pm »

App priority should not be changed.

You could try reading the link in my signature called "Weird Problems", just to get ideas.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42444
  • Shoes gone again!
Re: Prevent sound breaks during 100% CPU load
« Reply #2 on: April 01, 2019, 03:39:45 pm »

Increasing pre-buffering in Option > Audio is worth a try.
Logged
Matt Ashland, JRiver Media Center

RD James

  • Citizen of the Universe
  • *****
  • Posts: 1871
Re: Prevent sound breaks during 100% CPU load
« Reply #3 on: April 02, 2019, 02:57:12 am »

Options > Audio > Memory playback > Load decoded file into memory

This should fix the problem for the currently playing track. However, due to the way that Memory Playback is handled in Media Center, you may have gaps between tracks if CPU usage is high.
If only there were more options for Memory Playback to ensure that playback would never be interrupted by high CPU usage or slow disk/network access.
 
Increasing pre-buffering to 20s should help too, but means that you cannot control playback in the last 20s of a track.
Logged

LazyBorzoi

  • Recent member
  • *
  • Posts: 17
Re: Prevent sound breaks during 100% CPU load
« Reply #4 on: April 02, 2019, 03:31:23 pm »


If only there were more options for Memory Playback to ensure that playback would never be interrupted by high CPU usage or slow disk/network access.
 
I thought there was another option that allows loading the entire album in the memory. Wouldn't that work for this?
Logged

swiv3d

  • Guest
Re: Prevent sound breaks during 100% CPU load
« Reply #5 on: April 02, 2019, 03:42:51 pm »

Do alternative browsers cause the same problem?
Logged

RD James

  • Citizen of the Universe
  • *****
  • Posts: 1871
Re: Prevent sound breaks during 100% CPU load
« Reply #6 on: April 03, 2019, 03:32:58 am »

I thought there was another option that allows loading the entire album in the memory. Wouldn't that work for this?
Unfortunately not. The short version is that the description is literal. It will load the entire Playing Now list (not just an album) into memory before playback begins.
 
Originally there were very few limitations on this, so you could be waiting several minutes while it filled up 16GB of RAM before playback would begin.
Since it is only storing non-decoded tracks, it still does nothing to protect against high CPU usage from other processes interrupting playback.
 
I believe the memory limit for this feature has been reduced, but the problem with that is if the tracks in Playing Now exceed that amount, you wait minutes for it to try and fill up all of your RAM, have it fail, and then without any warning it will play directly from the disk/network as though you never enabled it to begin with.
 
It's not dynamic at all either. It doesn't try to keep an "album's worth of tracks" (say 10 tracks) in memory.
If you start playback when there are only 10 tracks in Playing Now, and add more to it, it does not try to load more upcoming tracks into memory when the current track finishes. It will reach the end of those 10 tracks and fall back to loading individual tracks into memory at the end of every track.
The only thing that option does is prevent slow disk/network access from interrupting gapless playback, and does it in the least efficient way possible, by eating up all of your free RAM.
 
 
"Load full file (not decoded)" is an efficient way to do memory playback, as it only stores one track in memory at a time, but it only protects against slow disk/network access for the current track.
High CPU usage can still interrupt it, and slow disk/network access can still create gaps during playback as it only has the pre-buffering duration to load the next track into memory - and that's often not enough.
 
"Load decoded file into memory" uses more RAM (a lot more for formats like DSD - particularly multichannel) but can protect against both slow disk/network access during playback, and high CPU usage during playback - to a point.
The issue is that this option creates very high CPU usage at the end of every track because it tries to decode the next track as quickly as possible.
This means it doesn't play nicely if you use your computer for anything else. For example: if you are playing a game and listening to music, it can cause bad stuttering every time the track changes.
 
 
Ideally the playback system would be some combination of these options:
  • It would store tracks non-decoded in memory, since that uses significantly less RAM.
  • It would store multiple tracks in memory to prevent slow disk/network access causing gaps in playback; ideally this would be a buffer of a minimum audio duration rather than a fixed number of tracks (keep 10 minutes of upcoming audio in memory) or perhaps a fixed size (keep a buffer of 1GB) since a fixed number of tracks could vary significantly in duration/size.
  • It would unload previous tracks, and load tracks in advance. It should never be loading the next track into memory in the last few seconds of the current track. At the very least, the next track should always have been loaded into memory before the current track started playing.
  • Optionally, slowly decoding the upcoming track into memory could help prevent issues on systems where the cause of interruptions is high CPU usage from other processes. Decode the first track into memory quickly, but then use a rate-limited decoding for the next upcoming track or two, to prevent large spikes in CPU usage. This option would have moderate memory and CPU usage, but protect against all scenarios where playback could be interrupted, rather than only some of them.
You can kind-of force Media Center to buffer the upcoming track early if you edit the registry to extend the pre-buffering duration to something far longer than 20 seconds.
If I recall correctly, I set it to ~180 seconds the last time I tried this, which meant that it loaded the current track in memory and had plenty of time to load the upcoming track as well.
The problem is that once Media Center enters the pre-buffering stage of playback you lose control over the currently playing track, and the option would reset after restarting Media Center.
 
 
Currently, the only option that I would recommend people use is the "Load full file (non-decoded) into memory" one, as it does not use an excessive amount of RAM, and prevents disk access interfering with the currently playing track.
However, this can break gapless playback if you are loading from a network connection or a portable disk that sleeps frequently.
 
This scenario, where the issue is high CPU usage from other processes running on the system interrupting playback, is the only time I'd recommend the "Load decoded file into memory" option.
 
It's why I'd like to see Memory Playback revamped for MC25. Most of the components for creating an ideal Memory Playback system are there, but it needs reworked to create a system that prevents most if not all causes of playback interruption, without also causing Media Center to interfere with other processes running on that computer - whether that's excessive memory usage, disk access, or high CPU usage.
Logged

dtc

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3125
Re: Prevent sound breaks during 100% CPU load
« Reply #7 on: April 03, 2019, 08:19:25 am »

The load album into memory options were not designed to handle high CPU cases. They were, in fact, designed to have as little as possible usage of the disk and CPU during playback.

The best thing to do in this case is to try each option and see if any work for you.
Logged

LazyBorzoi

  • Recent member
  • *
  • Posts: 17
Re: Prevent sound breaks during 100% CPU load
« Reply #8 on: April 03, 2019, 09:22:47 am »

Thanks, RD James and dtc.
I had a problem with playback freezing midtack while outputting via ASIO to my external DAC. MC would display "buffering" message and it would last for up to two minutes sometimes).
Not really sure what was causing it (I'd still like to figure this out) but choosing "load album in memory" seemed to helped... I only had JRiver running while playing the music so there were no other resource-hungry application (that I know of...)

Btw, apparently it wasn't player-specific. I had the same problem with Foobar player...
Logged

DJLegba

  • Citizen of the Universe
  • *****
  • Posts: 995
Re: Prevent sound breaks during 100% CPU load
« Reply #9 on: April 03, 2019, 10:07:55 am »

I'd be surprised if this had anything to do with MC. Have you removed any Dell apps you don't need? Are there any indications of hardware problems in the Windows event logs? Have you tried disabling the anti-malware scanner that Chrome installs? I'm running MC on an older NUC with an i3 CPU and only 4GB of RAM, and opening a page in a new tab in Chrome doesn't cause a 100% utilization spike. And even when I can make the CPU utilization spike to 100%, MC playback isn't interrupted.

The only MC-related issue I can think of is the WDM driver. If you've configured that as your default sound driver in Windows, playback can be interrupted briefly when Windows makes a system sound - but you'd hear that, unless you have the system speaker muted or the volume set to 0. If you do have the WDM driver installed, try uninstalling it.
Logged

dtc

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3125
Re: Prevent sound breaks during 100% CPU load
« Reply #10 on: April 03, 2019, 10:28:28 am »

Thanks, RD James and dtc.
I had a problem with playback freezing midtack while outputting via ASIO to my external DAC. MC would display "buffering" message and it would last for up to two minutes sometimes).
Not really sure what was causing it (I'd still like to figure this out) but choosing "load album in memory" seemed to helped... I only had JRiver running while playing the music so there were no other resource-hungry application (that I know of...)

Btw, apparently it wasn't player-specific. I had the same problem with Foobar player...

You sometimes see this type of problem if the disk access is delayed for any reason. One thing that can cause it is if the disks are set to sleep after a period of time. If you are using a NAS, then delays can also happen if the NAS is not performing well.
Logged

LazyBorzoi

  • Recent member
  • *
  • Posts: 17
Re: Prevent sound breaks during 100% CPU load
« Reply #11 on: April 09, 2019, 11:22:54 am »

You sometimes see this type of problem if the disk access is delayed for any reason. One thing that can cause it is if the disks are set to sleep after a period of time. If you are using a NAS, then delays can also happen if the NAS is not performing well.
Ha! I bet that is exactly what was going on. I was using an external hard drive when I had MC freezing problems...
Logged
Pages: [1]   Go Up