Comparison CPU Usage (2)

I would like to open a new thread for my latest measurements as I changed the methodology quite a bit. Results are a bit more scientific now… hopefully… The measurement took quite some time to execute and calculate results. So hopefully the numbers are of interest to anybody…

Hardware:
Device: Sony BRAVIA 2015
SoC: MediaTek MT5890 (2x ARM Cortex A17 @ 1GHz, ARM Mali T624 MP2, 1.5GB RAM) (no speed-stepping)
OS: Android TV 6.0.1 (Linux kernel 3.10.79)

Video:
TransportStream sample with H.264 [email protected] 720p50 video (5-6mbps) and AC3 audio (via Passthrough if possible) played from an USB pen drive.

Methodology:
CPU usgage has been measured via top command with a resolution of 1s:

Code:
top -m 10 -n 100 -d 1

From 100 measurements, the average and maximum has been calculated for user- and kernelspace activity, plus the most demanding processes separately as well.

The device has been rebooted before moving to the new player. The measurement was started after all startup processes have finished work.

Results:

Kodi 18.0-ALPHA1 (2017-05-20) – MediaCodec Surface

Code:
User:                        14% (peak: 20%)
System:                      14% (peak: 19%)
---
org.xbmc.kodi                11% (peak: 15%)
/system/bin/surfaceflinger    4% (peak:  5%)

Recent builds reduced CPU usage by about 5% (2-3% on Kodi itself, 2-3% on surfaceflinger).

Problem with MediaCodec Surface is that it produces quite severe stuttering on some videos, see this thread, even though resolution and framerate are quite low (720p25). It looks like audio drifts apart and a video glitch every few seconds takes care of it, resyncing to audio.

Kodi 18.0-ALPHA1 (2017-05-20) – MediaCodec

Code:
User:                        22% (peak: 33%)
System:                      31% (peak: 56%)
---
org.xbmc.kodi                22% (peak: 32%)
/system/bin/mediaserver      11% (peak: 22%)
/system/bin/surfaceflinger    4% (peak:  8%)

The 720p50 sample already suffers from stuttering in non-Surface mode on the weak MediaTek SoC. CPU usage is at 50% on average but can easily go above 80%. Going beyond 720p25 is a no-no. The problematic 720p25 video runs smoothly in non-Surface mode though. So the timing seems to be better in non-Surface mode. Higher resolution/framerate content is not feasible anymore though.

What is the mediaserver process and why does it consume so much more CPU time in non-Surface mode?

Kodi 18.0-ALPHA1 (2017-05-20) – MediaCodec w/ main menu overlay

Code:
User:                        37% (peak: 44%)
System:                      30% (peak: 38%)
---
org.xbmc.kodi                36% (peak: 44%)
/system/bin/mediaserver      11% (peak: 14%)
/system/bin/surfaceflinger    4% (peak:  5%)

non-Surface mode plus menu overlays is killer! Surface mode is a must on Sony and Philips TVs! Unfortunately, there is the issue with those problematic videos that don’t play smoothly.

VLC – MediaCodec Surface

Code:
User:                        12% (peak: 27%)
System:                      19% (peak: 36%)
---
org.videolan.vlc             10% (peak: 17%)
/system/bin/surfaceflinger    3% (peak:  4%)

The problematic video shows the same symptoms as when played inside Kodi with MediaCodec Surface being engaged.
The decoder can be switched to IOMX (libstagefright?) and between Surface and non-Surface modes. Neither does any mode allow screencaps to be taken nor do they fix the problematic videos. So I assume that playback always defaults to MediaCodec Surface.

Video (libstagefright?) – stock player app

Code:
User:                         1% (peak:  9%)
System:                       4% (peak: 15%)

All processes involved with playback stay well under 1% (e.g. surfaceflinger). The Video app might not be using MediaCodec, but most probably libstagefright instead. But it at least seems to be using Surface as it is not possible to take screencaps of the playing video. Also CPU usage suggests that.

The problematic videos play smoothly inside the Video app despite the supposed Surface usage.

Also Google’s Live Channels app plays 720p50 live content without any significant impact on CPU usage on the Sony.

MX Player – HW mode (MediaCodec Surface)

Code:
User:                         5% (peak: 12%)
System:                       5% (peak: 18%)
---
/system/bin/mediaserver       6% (peak:  8%)
/system/bin/surfaceflinger    2% (peak:  3%)

Interesting part about MX Player is that most CPU is consumed by the mediaserver process. MX Player process hardly consumes any CPU.

Screencaps are not possible (=Surface). Problematic videos also stutter when played via MX Player.

MX Player – HW+ mode (libstagefright?)

Code:
User:                         7% (peak: 17%)
System:                      20% (peak: 34%)
---
/system/bin/mediaserver       7% (peak:  9%)
/system/bin/surfaceflinger    7% (peak:  7%)
com.mxtech.videoplayer.ad     4% (peak:  7%)

Screencaps are possible, so this is most probably a non-Surface mode. This one uses way less resources compared to Kodi though. Problematic videos play smoothly after engaging HW+ mode.