moonlight-android
moonlight-android copied to clipboard
[Issue]: very bad stutter on s22 ultra with exynos
Describe the bug
While trying moonlight on my samsung s22 ultra(exynos soc) and me m1 ultra mac I'm met with horrible unwatchable stutter in the game I mostly play: efootball 2024. Not the same happens with my windows 11 dell notebook. This is on the same network, same settings. For the phone and Mac I have used a multiport hub that allows me to connect hdmi and 1000mbit wired networkingn. It's not the hub, because i have tested it on the dell laptop and no issues there. Even tried without the dongle on wifi6e network, all the same. No windows client... Horrible stutter I'm using the latest version of sunshine on my host and the latest version of moonlight on my mac and s22 While on my Mac things are not perfect as they are on windows, the shutters are not that bad as they are on my s22 ultra
Steps to reproduce
Play on arm device
Affected games
Efootball 2024
Other Moonlight clients
PC
Moonlight adjusted settings
Yes
Moonlight adjusted settings (please complete the following information)
1080p 60fps Smoothest frame pacing aetting
Moonlight default settings
No
Gamepad-related connection issue
No
Gamepad-related input issue
No
Gamepad-related streaming issue
No
Android version
14
Device model
Samsung galaxy s22 ultra
Server PC OS version
Windows 11 23h2
Server PC GeForce Experience version
Sunshine 0.21
Server PC Nvidia GPU driver version
546.17
Server PC antivirus and firewall software
Bitdefender total security
Screenshots
No response
Relevant log output
What logs should I provide? I'm away from home until monday so I only got the phone at hand for now
Additional context
No response
would logcat help?
So I powered on my old phone, xiaomi mi 9. It does support video output so it's hard to tell from the phone screen alone, but it's doesn't seem to have the same issue. Then again it doesn't have an exynos processor. The decoding latency is at least twice as low on the mi 9 The s22 ultra is using c2.exynos.hevc.decoder and the mi 9 omx.qcom.video.decoder.hevc
I also notice this on my samsung a51 and chromecast tv, but not on my x86 based steam deck.
According to what I read here : https://github.com/moonlight-stream/moonlight-android/blob/master/app/src/main/java/com/limelight/binding/video/MediaCodecHelper.java
Exynos should support both c2 and omx and moonlight should pick omx because it supports low latency, yet for some reaason it seems c2 is picked. Maybe @cgutman could help sort this out...
making baby steps progress...
I have installed Codec info on both S22 Ultra and Mi 9.
Couldn't find any OMX HW accelerated codec on my s22.
It says the c2.exynos.h264.decoder support low latency , but for me it makes no difference if I set moonlight to h264. Latency is the same as H265. 20+ ms
For c2.exynos.hevc.decoder it states low latency is not supported ( could it be undocomented? I find it wierd since latency is high on both hevc or h264 )
For Mi 9 it doesn't the low latency field doesn't even show up, yet there decoding latency is <10ms.
Just to compare , very low decoding latency with parsec.
This was on the start menu. But in gameplay is mostly 3ms. With any of h264 or h265
I've looked at the logs myself and I don't make much sense of them, but I feel tha the low-latency flag is set, not sure if it's done correctly as 20+ ms decoder latency isn't low at all.
noticed that if I screen record while Moonlight is streaming, the decoding time goes down to 10ms and even below. that's weird
here's a video recording: https://youtu.be/L_PfxgrGcJ4?si=CsTh5nf9qM-PopG9
and this screenshot is a few seconds after I stop the recording
it's almost like screen recording causes low latency mode to really enable.
and here's a parsec decoding latency...close to 1ms (and that's with hevc which according to codec info should not support low latency mode on this device)
if parsec isn't lying there seems low latency can be achieved somehow.
I have the same issue on the new S24 Plus.
10ms of decoding latency using c2.exynos.hevc.decoder.
Parsec, on the other hand, shows 4ms of Decode using HEVC at 1080p, which results in a much better experience latency-wise.
I'm not sure what decoder Parsec is using but the issue doesn't seem to be Exynos SoCs after all if Parsec can get low decoding times.
I also can't see any OMX decoders using Codec Info, only c2.
I should also note that screen recording while using Moonlight lowers the latency to 6ms, somehow.
5ms is not a perceptible difference, certainly not to the extent that you would clearly and obviously notice it. What you're actually feeling is SurfaceFlinger composition and display latency which is not measured by either Parsec or Moonlight in the decoder latency number.
The solution is probably to use Vulkan or OpenGL directly to render frames instead of going through MediaCodec.
What about the fact the Average decoding time is at least two times better if a screen recording is started? To me it seems low latency mode is not really enabled with this SoC @cgutman
@xCISACx can you try this scenario? while streaming with moonlight, start a screen recording and pause it.
What about the fact the Average decoding time is at least two times better if a screen recording is started? To me it seems low latency mode is not really enabled with this SoC @cgutman
@xCISACx can you try this scenario? while streaming with moonlight, start a screen recording and pause it.
I mentioned it in my post as well, yeah. Screen recording brings the decoding times down to 6ms.
What I do know is that I couldn't play Lies of P properly using Moonlight on Exynos, but I could on Parsec with no issues. It doesn't seem just like display latency to me since the inputs themselves felt smoother as well but I could be wrong.
Sorry. Missed that part of the comment. The problem for me, beyond the high decoding time is that the steam stutters very bad on my s22 uotra and it's not because of the network
5ms is not a perceptible difference, certainly not to the extent that you would clearly and obviously notice it. What you're actually feeling is SurfaceFlinger composition and display latency which is not measured by either Parsec or Moonlight in the decoder latency number.
The solution is probably to use Vulkan or OpenGL directly to render frames instead of going through MediaCodec.
Any idea why screen recording makes decoding times better though? If Moonlight could do what screen recording does to lower the decoding times, that would help.
To me it seems low latency mode is not really enabled with this SoC
Low latency mode requires the decoder not to hold output of a frame more than 1 frame interval (or the codec's coded minimum). Therefore, under 1 frame of decode latency means low latency mode is working fine. Some codecs may do this by default, so those don't expose a separate low latency mode.
Any idea why screen recording makes decoding times better though?
It is probably due to DVFS. Moonlight has very low CPU and GPU usage, so it doesn't put the device into higher power modes that have the side effects of also slightly improving decode time.
I suggest turning off the performance overlay (to avoid placebo effect) and then seeing if you (or better yet, someone without experience testing either configuration) actually tell a perceptible latency difference between screen recording on and off.
I started a game (sonic force) split screen with moonlight stream started and decoding time didn't improve at all, if anything it was worse at times. shouldn't games force the same mode too?
I started a game (sonic force) split screen with moonlight stream started and decoding time didn't improve at all, if anything it was worse at times. shouldn't games force the same mode too?
Can you tell a difference between recording on and off in terms of latency like cgutman asked?
it's impossible for me to tell. the stutter I'm experiencing is very bad.
any improvements that can be made here or I just have to get a new phone that doesn't have exynos?
I think it is possible to improve, but we'll need to rewrite the video renderer to use Vulkan or OpenGL ES and use the frame pacing library in the Google Game SDK. It's not an easy fix.
well, if it happens before my next phone it happens, if it doesn't, it doesn't hehe. suits me as a lesson to avoid phones that don't have an snapdragon soc. thanks for all the great work over the years!
Hello everyone, I bring you a temporary solution for the stuttering problem when streaming on the S24+. I saw in the thread that they recommended recording the screen while playing, and this could work. Indeed, I tried it, and it worked. In my case, it reduced the latency of video decooding from 12ms to 5ms. However, I think this unnecessarily wears out the device. Therefore, I started looking for another application that could achieve a similar result to recording the screen. What I found is that if the CPU-Z app runs in the background, it completely eliminates the stuttering problem. It should be noted that sometimes it doesn’t work the first time, so you have to open and close both Moonlight and CPU-Z. In my case, I programmed a routine (with the automation functions found in the phone settings) that makes CPU-Z open Moonlight and set the phone to maximum performance every time it opens. This way, I only have the CPU-Z shortcut on the desktop, and this solved the stuttering problem, but not the latency. The video decoding latency is still around 13ms. I hope this helps and that you can enjoy your remote gaming sessions.
Here is the download link for CPU-Z. https://play.google.com/store/apps/details?id=com.cpuid.cpu_z&pcampaignid=web_share
going to test this, but surely the solution lies in cgutman's hands when he has time