ClassicOldSong / moonlight-android

GameStream client for Android
GNU General Public License v3.0
291 stars 7 forks source link

[Issue]: FPS Drop/ Lag on Galaxy S23 #38

Closed Archit01 closed 2 weeks ago

Archit01 commented 3 weeks ago

Describe the bug

Due to Variable FPS there is significant lag on Android Device:Galaxy S23. If there is no action fps drop down and resulting in lag. Due to this Game becomes unable to play and can't stream video. Streaming works fine on PC. Also Parsec on Android works fine but the issue is with sunshine/Apollo, Nvidia Game stream and Moonlight/Artemis Pc setup for Streaming Rtx 2060 super Intel core i5 11th gen Windows 11 24h2 16gb ram

Steps to reproduce

1.) Configure Apollo for Nvidia: Default settings 2.) Moonlight/Artemis: Stream at 1080p 60fps. Galaxy S23 3.) Variable refresh rate is disabled in PC /Not supported. 4.) Tried Adaptive motion/Standard 60hz on Galaxy S23; Issue present on both. 5.) Same issue with orignal Sunshine and Moonlight.

Affected games

All games and Video playback is affected due to fps drop.

Other Moonlight clients

None

Moonlight adjusted settings

None

Moonlight adjusted settings (please complete the following information)

From 720p to 1080p 60fps. Although issue is present on all resolutions.

Moonlight default settings

Yes

Gamepad-related connection issue

No

Gamepad-related input issue

No

Gamepad-related streaming issue

No

Android version

Android 14

Device model

Samsung Galaxy S23

Server PC OS version

Windows 11 24H2

Server PC GeForce Experience version

No response

Server PC Nvidia GPU driver version

No response

Server PC antivirus and firewall software

Windows Defender

Screenshots

No response

Relevant log output

No response

Additional context

No response

ClassicOldSong commented 3 weeks ago

Have you tried enable Enforce Display Mode in Artemis's settings? Also setting to a higher refresh rate could reduce lag greatly.

Also please lower bitrate to a reasonable value, setting it too high will greatly increase latency when network fluctuates.

Archit01 commented 3 weeks ago

Yes, I have tried enforce display mode but issue is still there. Checked with lower bitrate doesn't solve the issue. Network is stable.

If I keep touching the screen then there is less lag/stuttering but as soon as I stop touching the display it start to stutter and lag.

ClassicOldSong commented 3 weeks ago

Unfortunately I don't have a Samsung device to debug and it seems it's a long presenting problem with Samsung high end devices only. Can you go to Android's developer settings and check if there's option to enforce refresh rate or disable vrr?

Archit01 commented 3 weeks ago

I have tried to enforce 120hz or 60hz using galaxy Max Hz app as there is no option in developer settings. But the issue is somehow not because of vrr as even after forcing constant 120hz the issue is still there. It is based on input somehow as long as screen is being touched it will not stutter.

How can I provide log to help debug this issue ?

This is not the case with parsec.

ClassicOldSong commented 3 weeks ago

Current logs could provide no information about this issue. I need a physical device to do in-depth digging to pin point the real problem.

Archit01 commented 3 weeks ago

Thank you for the help.

I found this old link where someone with samsung device has similar kind of issue. https://github.com/moonlight-stream/moonlight-android/issues/1285#issuecomment-2054167660

ClassicOldSong commented 3 weeks ago

As mentioned in that issue, can you try using scrcpy while streaming and see if it stabilizes the framerate?

Archit01 commented 3 weeks ago

With Scrcpy do you mean that should I mirror the Android screen to windows back ? Or just do the screen recording while streaming ?

Another thing to mention that I have Qualcomm processor Snapdragon 8gen 2 in Galaxy S23.

ClassicOldSong commented 3 weeks ago

Just try mirror it back wired and see if it works

Archit01 commented 3 weeks ago

Just tried Scrcpy for screen mirror and also tried screen recording or opening Cpuz app in background as reported by other but no luck. Stuttering is still there. FPS meter shows fps fluctuate even during video playback causing stutter. One thing during testing I got is if I switch the app multiple times from some other app or just even device settings then video playback in streaming becoming stutter free for few minutes then it return back to stuttering if video is closed or open again or even if it is left for playing but after few mins.

ClassicOldSong commented 3 weeks ago

That's very unfortunate...

I just tried multiple ways trying to bypass the issue on one of my device that support dynamic refreshrate without enforce display mode enabled, but failed. Even if I explicitly request render at a higher frequency, the actual render function is only called at 60hz.

Sometimes vendors just hardcode package names for whitelisting apps that require high refresh rate and there's totally no way to workaround the limit...

TungAn commented 2 weeks ago

@Archit01 hi, have you tried to play around with the frame pacing settings? Can try to set it as "Balanced" and see if it fixes your stutter. I have an S23 ultra with the same chipset and the same behavior, the only way to reduce the stutter is to force the stream rendering with screen v-sync. Note that it will buffer 1 more frame to reduce the suttering so latency will increase

Another option is to try streaming 120fps with 120hz, then lock the game fps to 60fps. It will reduce the stutter

Archit01 commented 2 weeks ago

I have tried frame pacing options it fix to some extent but not full and stutter eventually returns. Tried Vsnc in game and moonlight both. For forcing 120hz on galaxy phones you can use Galaxy Max Hz app. It will fix vrr issue. But stutter is still there for unknown reasons with moonlight. With vrr enabled parsec works fine so can't figure out what is the issue.

ClassicOldSong commented 2 weeks ago

You can try using some apk editors to change the package name to parsec's or some benchmark tools like 3dmark or Antutu and see if it works. If so, it's a whitelist issue that there's no way to fix.

Archit01 commented 2 weeks ago

I checked the refresh rate using developer settings and both parsec and Moonlight stays at 120hz with no vrr during streaming. Therefore it's not the issue with whitelisting.

With moonlight it require constant touch input on screen to make stream stutter free. With no touch input screen stays at constant 120hz but stream lag/stutter.

ClassicOldSong commented 2 weeks ago

Check if there's significant frame skipping when there's no input: https://www.testufo.com/frameskipping

It's still a system "optimization" strategy that makes view updates capped. It's a vendor specific issue and this should be reported to Samsung as well.

TungAn commented 2 weeks ago

@Archit01 also you can try to set the battery unrestricted under App > Artermis settings. Default is optimized that may reduce the performance

Archit01 commented 2 weeks ago

I have some development and issue might be fixed somehow. I will share the details today after testing again.

Archit01 commented 2 weeks ago

Update: I have tested few times and issues seems to be fixed. But I couldnt figure out how it is fixed. Following are things I did Updated the Device to Oct security update but that was 1 day before. Unpair the device and reinstall the app several times Run the frameskip test on both Android and PC for few minutes to check frame skip no issue found. Additionally then run frame skipp during stream no issue found. My Internet had some issue from backend for an hour so I had restarted the Router. (But that was also tried many times before) There was security update in windows before issue was resolved.

Thank you for the support. 😊

ClassicOldSong commented 2 weeks ago

It should be the device update changed something about rendering...

Archit01 commented 2 weeks ago

The issue is fixed. So I am closing this issue. Thank you for the support once again.