High CPU usage & Video stuttering while streaming
#1
Hello,

I've been facing video stuttering while streaming for a while and I wanted to post it here since I'm not being able to solve it myself.

I'm not 100% sure, but I believe it started happening when OE upgraded to 4.0.7. However, I've been able to reproduce the same issue in OE 4.1.3 and most recent Helix Builds (Aug 7 for instance).

For instance, if I try to play this Youtube video (https://www.youtube.com/watch?v=m-M1AtrxztU) everything seems to be working just fine but when I move the mouse to show the context buttons and progress bar, these controls take a lot to appear and they are barely manageable since the video starts to stutter and at the end it just hangs. Taking a look at "top" I can see that CPU usage has an average of 70% whereas with Frodo the average does not surpass 30%. (Always with overclock)

Longer videos like https://www.youtube.com/watch?v=wbCCJPTzFA0 don't event start to play, XBMC gets stuck in the "Working" spinner.

What I've tried to tackle the problem so far:

- Setting gpu_mem=100 as a used to have with Frodo.
- Setting cachemembuffersize 2621440 as in Frodo
- Fresh install of Helix Build
- Fresh install of OE 4.0.7
- Fresh install of OE 4.1.3

In order to rule out a hardware problem I have also done a fresh install of Frodo RBEJ (January 2014) and the issue is gone, everything works out of the box.

Is there any reason for this behaviour?

Thank you very much in advance.

LOGS:

Dmesg output: http://sprunge.us/OSXM

First video:

Code:
11:55:56 T:3059614240  NOTICE: COMXPlayer: Opening: https://r1---sn-w511uxa-h5qz.googlevideo.com/videoplayback?
11:55:56 T:3059614240 WARNING: CDVDMessageQueue(player)::Put MSGQ_NOT_INITIALIZED
11:55:56 T:2831754320  NOTICE: Thread OMXPlayer start, auto delete: false
11:55:56 T:2831754320  NOTICE: Creating InputStream
11:55:56 T:2766140496  NOTICE: Thread FileCache start, auto delete: false
11:55:56 T:2831754320  NOTICE: Creating Demuxer
11:55:59 T:2831754320  NOTICE: Opening video stream: 0 source: 256
11:55:59 T:2831754320  NOTICE: Creating video thread
11:55:59 T:2774529104  NOTICE: Thread OMXPlayerVideo start, auto delete: false
11:55:59 T:2831754320  NOTICE: Opening audio stream: 1 source: 256
11:55:59 T:2831754320  NOTICE: Creating audio thread
11:55:59 T:2734683216  NOTICE: Thread OMXPlayerAudio start, auto delete: false
11:55:59 T:2831754320  NOTICE: OMXClock using audio as reference
11:55:59 T:2774529104  NOTICE: Display resolution DESKTOP : 1680x1050 (1680x1050) @ 60.00 - Full Screen (16)
11:56:00 T:3059614240  NOTICE: Using GL_TEXTURE_2D
11:56:00 T:3059614240  NOTICE: GL: Using BYPASS render method
11:56:00 T:3059614240  NOTICE: GL: NPOT texture support detected
11:56:01 T:2774529104 WARNING: CRenderManager::WaitForBuffer - timeout waiting for buffer
11:57:42 T:2724197456 WARNING: Previous line repeats 89 times.
11:57:42 T:2724197456  NOTICE: Thread JobWorker start, auto delete: true
11:57:42 T:2774529104 WARNING: CRenderManager::WaitForBuffer - timeout waiting for buffer

Longer video:

Code:
12:01:29 T:3059614240  NOTICE: COMXPlayer: Opening: https://r7---sn-w511uxa-h5qe.googlevideo.com/videoplayback?ratebypass=yes&mm=31&id=o
12:01:29 T:3059614240 WARNING: CDVDMessageQueue(player)::Put MSGQ_NOT_INITIALIZED
12:01:29 T:2766140496  NOTICE: Thread OMXPlayer start, auto delete: false
12:01:29 T:2766140496  NOTICE: Creating InputStream
12:01:30 T:2766140496  NOTICE: Creating Demuxer
12:01:30 T:2774529104  NOTICE: Thread FileCache start, auto delete: false
12:01:35 T:2766140496  NOTICE: Opening video stream: 0 source: 256
12:01:35 T:2766140496  NOTICE: Creating video thread
12:01:35 T:2831754320  NOTICE: Thread OMXPlayerVideo start, auto delete: false
12:01:35 T:2766140496  NOTICE: Opening audio stream: 1 source: 256
12:01:36 T:2766140496  NOTICE: Creating audio thread
12:01:36 T:2706957392  NOTICE: Thread OMXPlayerAudio start, auto delete: false
12:01:38 T:2766140496  NOTICE: OMXClock using audio as reference

CPU USAGE: Image
Reply
#2
I`ve noticed a similar problem. Even if i quit the video, the cpu stays at 100%. I`ve just updated to the latest beta to see if it helps.
Reply
#3
Hello!

Could anyone with OE 4.0.7 or higher check their Cpu usage while streaming one of those videos? Can you skip or pause and resume without problems?

Thanks in advance!
Reply
#4
(2014-08-10, 14:31)jesus225 Wrote: but when I move the mouse to show the context buttons and progress bar, these controls take a lot to appear and they are barely manageable since the video starts to stutter and at the end it just hangs.
I have mouse input disabled so can't test this.

(2014-08-10, 14:31)jesus225 Wrote: Longer videos like https://www.youtube.com/watch?v=wbCCJPTzFA0 don't event start to play, XBMC gets stuck in the "Working" spinner.

This video plays foot-tappingly fine on one of my builds (build #0811b) with a 1GHz/512MB Pi (256/256 GPU split, default <cachemembuffersize> (so 20MB on a 512MB Pi, 2MB on a 256MB Pi). CPU load is 27-28% while playing this video, and there's a constant 9.9-10MB/100% buffer (my internet connection is 20Mb/s downstream).
Code:
15:19:31 1244.897583 T:2789209168  NOTICE: YouTube-4.4.10
15:19:32 1245.836182 T:2789209168  NOTICE: CommonFunctions-2.5.1
15:19:35 1248.879517 T:2789209168  NOTICE: links: 'dict'
15:19:36 1249.617798 T:3058721312 WARNING: CPlayerCoreFactory::GetPlayerCore(videodefaultplayer): no such core: omxplayer
15:19:36 1249.788818 T:3058721312  NOTICE: DVDPlayer: Opening: https://r19---sn-aigllnsz.googlevideo.com/videoplayback?itag=22&signature=B3C6F6057859CBC595EFE2CD35E45F134C085C89.BC5DAD33421973D825F7FD24557FD3C5B6D03B39&mm=31&requiressl=yes&sver=3&mv=m&mt=1407853085&sparams=id,initcwndbps,ip,ipbits,itag,ratebypass,requiressl,source,upn,expire&expire=1407874773&upn=9YpZ3s5-6mM&id=o-AIsILy2TUIbcWapJGOUzl0XmmeZpfoViZs3xv2bWOEZw&ms=au&fexp=900233,902408,927622,931983,934024,934030,935663,945058,945122,946008,948600&source=youtube&nh=IgpwcjAxLmxocjA3KgkxMjcuMC4wLjE&mws=yes&initcwndbps=868000&ip=87.81.206.88&key=yt5&ipbits=0&ratebypass=yes|User-Agent=Mozilla%2F5.0+%28Windows+NT+6.2%3B+Win64%3B+x64%3B+rv%3A16.0.1%29+Gecko%2F20121011+Firefox%2F16.0.1
15:19:36 1249.789062 T:3058721312 WARNING: CDVDMessageQueue(player)::Put MSGQ_NOT_INITIALIZED
15:19:36 1249.793457 T:2893370448  NOTICE: Thread DVDPlayer start, auto delete: false
15:19:36 1249.796143 T:2893370448  NOTICE: Creating InputStream
15:19:37 1250.966187 T:2893370448  NOTICE: Creating Demuxer
15:19:37 1250.970093 T:2771870800  NOTICE: Thread FileCache start, auto delete: false
15:19:40 1253.390991 T:2893370448  NOTICE: Opening stream: 0 source: 256
15:19:40 1253.430420 T:2893370448  NOTICE: Creating video thread
15:19:40 1253.431030 T:2893370448  NOTICE: Opening stream: 1 source: 256
15:19:40 1253.445190 T:2876593232  NOTICE: Thread OMXPlayerVideo start, auto delete: false
15:19:40 1253.457642 T:2893370448  NOTICE: Creating audio thread
15:19:40 1253.459106 T:2659185744  NOTICE: Thread OMXPlayerAudio start, auto delete: false
15:19:40 1253.482910 T:2893370448  NOTICE: OMXClock using audio as reference
15:19:40 1253.504272 T:2876593232  NOTICE: Display resolution DESKTOP : 1920x1080 (1920x1080) @ 60.00 - Full Screen (16)

(2014-08-10, 14:31)jesus225 Wrote: - Setting gpu_mem=100 as a used to have with Frodo.

This is a bit low. As you're on a 256MB Pi I'd suggest bumping it to 112 or even 128 if you can.
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
#5
(2014-08-12, 16:39)Milhouse Wrote: This is a bit low. As you're on a 256MB Pi I'd suggest bumping it to 112 or even 128 if you can.

I'd recommend gpu_mem=112 on a recent (e.g. 4.1.3) build.
We reduced the gpu memory requirement a fair bit with the last update, and some reductions only trigger when gpu_mem < 128.

Milhouse if you add total_mem=256, gpu_mem=112 does the video still play as well? That will behaves the same as a 256M Pi.
Reply
#6
(2014-08-12, 16:53)popcornmix Wrote: Milhouse if you add total_mem=256, gpu_mem=112 does the video still play as well? That will behaves the same as a 256M Pi.

OK no, it won't play when simulating a 256MB Pi with 112MB GPU, even though I had 55MB RAM free (47MB GPU free). It seems to hang, but ping still responds, so I think the CPU is just maxed out somewhere and no longer responding.

I also tried 128MB GPU, same result.

It looks like newclock4 doesn't have the patch that varies cachemembuffersize according to memory size, so not entirely sure what cachemembuffersize #0811b is using by default.

I tried setting cachemembuffersize to 2MB (while using 112MB for gpu_mem) and now the above video simply crashes xbmc.bin after a few seconds.
Code:
16:49:14 254.568893 T:2894066768  NOTICE: YouTube-4.4.10
16:49:15 255.497681 T:2894066768  NOTICE: CommonFunctions-2.5.1
16:49:20 259.927155 T:2894066768  NOTICE: links: 'dict'
16:49:21 261.627014 T:3059257888 WARNING: CPlayerCoreFactory::GetPlayerCore(videodefaultplayer): no such core: omxplayer
16:49:22 262.111908 T:3059257888  NOTICE: DVDPlayer: Opening: https://r19---sn-aigllnsz.googlevideo.com/videoplayback?expire=1407880159&nh=IgpwcjAxLmxocjE0KgkxMjcuMC4wLjE&mm=31&source=youtube&mws=yes&ratebypass=yes&ipbits=0&initcwndbps=883000&key=yt5&ip=87.81.206.88&sver=3&requiressl=yes&itag=22&signature=A8E6B80EDFA1812B1C6232CAB6986778A7CA6CA0.56511F9745201952D99C3214ECE49C932A75FA1C&upn=BNZwagcE41I&ms=au&fexp=901466,902408,908548,916602,927622,931983,934024,934030,945025,946013&id=o-AOCQKcUijLvB2OmQoCJbkw8SG-LGyDA4DBtFi1Qc2Cyh&mv=m&sparams=id,initcwndbps,ip,ipbits,itag,ratebypass,requiressl,source,upn,expire&mt=1407858384|User-Agent=Mozilla%2F5.0+%28Windows+NT+6.2%3B+Win64%3B+x64%3B+rv%3A16.0.1%29+Gecko%2F20121011+Firefox%2F16.0.1
16:49:22 262.112274 T:3059257888 WARNING: CDVDMessageQueue(player)::Put MSGQ_NOT_INITIALIZED
16:49:22 262.577881 T:2773959760  NOTICE: Thread DVDPlayer start, auto delete: false
16:49:22 262.594818 T:2773959760  NOTICE: Creating InputStream
16:49:24 264.655121 T:2877289552  NOTICE: Thread FileCache start, auto delete: false
16:49:25 264.758636 T:2773959760  NOTICE: Creating Demuxer
<xbmc.bin restarted>

The reason for the crash is OOM:
Code:
rpi512:~ # /usr/lib/xbmc/xbmc.bin --standalone -fs
Killed

dmesg.

With cachemembuffersize set to 20MB (again, 112MB for gpu_mem), the GUI hangs on "Working" as the OP stated.

It doesn't seem particularly specific to this video, I had trouble getting pretty much any YouTube video to play.

A *lot* of CPU time seems to be spent on iowait.
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
#7
Hello,

I'm observing high CPU too. It happens only sometimes and I've noticed it only during streaming from internet no matter video (Youtube) or audio (internet radio). Tried to isolate problem and noticed that {FileCache} eats most of CPU cycles. It increases with time from fairly low 1%-2% CPU to very high value. See below screenshot.

Image

P.S. I'm on 512Mb RPi (gpu_mem=128) and latest Millhouse build (#0811, 11-Aug-2014:; newclock3)
Reply
#8
(2014-08-12, 18:13)Milhouse Wrote: It looks like newclock4 doesn't have the patch that varies cachemembuffersize according to memory size, so not entirely sure what cachemembuffersize #0811b is using by default.
You are correct. I've added it now.

Quote:I tried setting cachemembuffersize to 2MB (while using 112MB for gpu_mem) and now the above video simply crashes xbmc.bin after a few seconds.

Okay. raspbmc has done some investigation into 256M performance and things are working better now.
Perhaps we need to look more closely at openelec settings.

I think they have swap enabled and set to 96M
vm.swappiness set to a higher value (perhaps 20)
gpu_mem=112
720p gui (this should be automatic in a clean install, but you may have to set it manually if updating).
Reply
#9
(2014-08-12, 18:33)darzur Wrote: I'm observing high CPU too. It happens only sometimes and I've noticed it only during streaming from internet no matter video (Youtube) or audio (internet radio). Tried to isolate problem and noticed that {FileCache} eats most of CPU cycles. It increases with time from fairly low 1%-2% CPU to very high value. See below screenshot.

Can you try buffermode=3
http://wiki.xbmc.org/index.php?title=HOW...ideo_cache

that should avoid the filecache which may be fine if your internet speed is good.

The CPU starting low and getting high doesn't sound right. Anyone else seeing this?
Reply
#10
(2014-08-12, 18:47)popcornmix Wrote: Can you try buffermode=3
http://wiki.xbmc.org/index.php?title=HOW...ideo_cache

that should avoid the filecache which may be fine if your internet speed is good.

The CPU starting low and getting high doesn't sound right. Anyone else seeing this?

I'll check buffermode=3 in a moment. Right now my RPi is playing music (from internet radio) and when I started it (few minutes ago) Filecache consumed below 1% CPU and now it's ~25% and growing.
Reply
#11
(2014-08-12, 18:53)darzur Wrote: I'll check buffermode=3 in a moment. Right now my RPi is playing music (from internet radio) and when I started it (few minutes ago) Filecache consumed below 1% CPU and now it's ~25% and growing.

Does memory use for xbmc.bin keep increasing too?
What add-on / station are you playing?
Reply
#12
(2014-08-12, 18:58)popcornmix Wrote: Does memory use for xbmc.bin keep increasing too?
What add-on / station are you playing?

Didn't check memory use - don't even know chow to check it. It's Radio Eska Rock (http://s5.deb1.scdn.smcloud.net/t041-1.mp3) played from direct link (not from any add-on). Changed buffermode to 3 and for now everything seems to be OK, but I'll need some time to check it thoroughly.
Reply
#13
(2014-08-12, 19:04)darzur Wrote: Didn't check memory use - don't even know chow to check it. It's Radio Eska Rock (http://s5.deb1.scdn.smcloud.net/t041-1.mp3) played from direct link (not from any add-on). Changed buffermode to 3 and for now everything seems to be OK, but I'll need some time to check it thoroughly.

Okay, I can play that stream. I'll see if I can reproduce the high cpu (it's 2% currently).

Update: It's up to 14% - that looks like a bug.
Reply
#14
I think I should add info about my configuration. I'm using USB flasdrive for SYSTEM and DATA partitions. SD is only for bootfiles and kernel. Besides all my local content (music, videos, TV shows) is on windows server and mounted on RPi through system.d mount files. RPi is overclocked to standard 1GHz values and I'm using IR Remote through lircd. This all may be or may not be important.
Reply
#15
(2014-08-12, 18:43)popcornmix Wrote: I think they have swap enabled and set to 96M
vm.swappiness set to a higher value (perhaps 20)
gpu_mem=112
720p gui (this should be automatic in a clean install, but you may have to set it manually if updating).

I'm not sure if OpenELEC has swap enabled by default on the Pi - pretty sure it doesn't. My testing above was without swap, 720 GUI and low colour textures.
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply

Logout Mark Read Team Forum Stats Members Help
High CPU usage & Video stuttering while streaming1