[10.0.2] Pi4 2GB - h264 streams slow over time, killing kodi.bin fixes temporarily

  • Hi,

    for a while I have had this issue, I even think ever since I switched to Pi4. I have a 2GB Pi4, which was recommended me (in terms of 2GB vs 4GB) to be more than enough for Kodi use. I'm running LE 10.0.2 now, but I've had this issue with 10.0.1 and some nightlies as well.

    When the Pi is just booted, everything is fine. I have TVHeadend running on the Pi, with an Anysee DVB-C tuner (just free-to-air channels) and everything works fine. However, I also use the RetroSpect add-in, as well as the Dutch Ziggo plugin, both stream h264 streams (both live TV and playback). When the Pi is just booted, everything is fine, and the streams run perfectly smooth, for as long as I want to watch. Then at night I shutdown the AV receiver the Pi is connected to, and the TV itself. Then in the morning, when turning all on again the following happens:

    The Kodi interface is choppy. h264 streams from RetroSpecs and the Ziggo plugin are extremely choppy and constantly need to re-buffer after a few seconds of playback. I constantly have one CPU core at 100%. DVD playback (ISO format) works fine, tvheadend streams are fine as well. I forgot to test h264 content from my NAS. When I run top from shell, I can see kodi.bin running at between 110% and 150% when doing choppy streams. When I use the debug stats in Kodi itself (with 'o' during playback) I can see one CPU core being at 100% all the time.

    Rebooting LE fixes this. However, I also tried killing just kodi.bin from shell and that fixes it too. So it seems something within Kodi seems to bug.

    Now I still have an old JVC 1280x720 tv, and it defaults to 1080i instead of 720p that I want. So in my cmdline.txt I have:

    boot=UUID=3010-5350 disk=UUID=a8e8a687-3b0f-472c-a2e4-3e8c903fd088 quiet video=HDMI-A-1:1280x720M@50

    to get Kodi to boot up in 720p. Kodi itself is set to 720p as well. Not sure if it has anything to do with it, but it might, as it only happens when I have turned off the receiver and tv for a longer time (ie a night or a few hours during daytime). When I enable debug logginf grom kodi and tail the kodi.log, I don't see ANY event though when I turn of the receiver / tv at all.

    How should I debug this, or what logs would you need?

    Thanks!

  • If cpu usage is unexpectedly high, you can run "perf top", leave it to settle for a few seconds,

    and the functions it identifies may give a clue to what it taking the cpu.

  • Running top in threads mode - just press "H" to toggle that - might also provide some clues.

    Usual suspects are addons freaking out and background tasks like addon / library updates.

    so long,

    Hias

  • Sorry, I didn't have notifications setup yet.

    perf top when the issue is there:


    top H when the issue is there:


    after killing kodi.bin, perf top without the issue:

    top H without the issue:

    It seems videoplayer consumes a bit less CPU after killing kodi. I can mostly trigger the issue, as said by turning of the TV and receiver. It seems it doesn't like the HDMI reset or something.

    [edit]

    by the way, bcmstat.sh shows my Pi is not throttling at all, even when videoplayer is using high cpu. As reported CPU load is relative to the CPU speed at that time (at least as far as I know) I thought it would be throttling, but it's not. Temps are fine too, between 50 and 55 celcius.