moonlight-stream / moonlight-android

GameStream client for Android
GNU General Public License v3.0
3.9k stars 616 forks source link

Samsung Galaxy S7 Edge (Android) - Streaming not optimal #349

Closed ghost closed 5 years ago

ghost commented 7 years ago

Hi there,

First off, thanks for creating this project. Next, if there is anything I can do to assist or troubleshoot on my end (logs, settings, etc), let me know, I'll be happy to do everything I can to get you as much info as possible.

Issue: On Samsung Galaxy S7 Edge (Android Marshmallow), the stream quality is jumpy, jerky, and very poor compared to streaming on Windows (on a late 2000's laptop) or OSX. I have not tested yet on an iPhone, but I can, if desired. In addition, it is also comparable, if not worse, to the quality of streaming that I encountered on my Galaxy Note 3 before upgrading to this device.

I can say for sure it has nothing to do with the target mbps, the wireless router, or the host pc. Multiple tests on other streaming devices have proved that the quality can be, and is, top-notch and smooth with no issues. It does not matter the resolution selected for streaming (720, 1080, 30 or 60fps). My decoding latency is only around 15ms on the device as well.

If I had to describe in detail the issue, the stream seems to display perfectly well, especially when not much on the screen is happening, but once the screen moves, such as a 2d scroller, the streaming shows signs of micro-studdering and has multiple instances of bigger frame jumps (such as the character is in one place on the screen during a jump, then, instead of taking the entire process smoothly, the scene may hang for a quarter second, then update with the character's current position, and then continue on as smooth as it was before the hang.

I've turned off extra services such as location service, mobile data, sync, etc on the device with no apparent improvement of streaming quality. So, with all of my resources exhausted, I'm posting this issue here in hopes that perhaps we can discover the cause, and hopefully have it addressed.

MichaelMKenny commented 7 years ago

@JasonS7notG5 I've been trying to sum up the courage to ask this also. I really hope Cameron might give us a build with less input lag :) Fingers crossed!

MichaelMKenny commented 7 years ago

I've been using the APK uploaded in this issue for the past while and performance is awesome! I can't go back to micro stutters on the Play Store build. I just really wish there was less latency.

I don't think it's input lag, as such, as I still have latency when connecting my controller directly to my PC. It just has more of a delay playing back the stream on the device, as apposed to what's been displayed on my PC's monitor.

If Cameron posts a build with fixed latency (5.0.2) I will be so happy and will be using Moonlight for Android all the time!

cgutman commented 7 years ago

Here's a new build with the latest changes and the microstuttering fix: https://drive.google.com/open?id=0B_5O1xNt8Q9lVkcxaXpkWTZzTDQ

chicozeb commented 7 years ago

Hi Cameron. Again, thanks for your hard work. I´ll test it later.

chicozeb commented 7 years ago

Here´s my specs.

Intel i7 3770K 3.9GHz Hyperthreading On Gigabyte GTX 1070 G1 Gaming (default mode - i don´t use gigabyte software) 16 GB Gskill DDR3 1866MHz cas9 64GB Sandisk SSD (OS) + 480 OCZ Trion 150 (games and apps and steam) + 1TB Western Digital Blue + 1TB Samsung HDD) Asus P8Z77V-LK(realtek ethernet card) 650Watt Antec Power Supply Lg E2350 1080p 60Hz monitor Huawei router HG8247H (ISP provided) Windows 10 Pro Founders Edition Latest drivers and GFE.

I use ethernet connected all the time. No wifi to stream.

I use Shield TV mainly. But usually use the nvidia official app, because it uses h.265 and moonlight uses h.264 on shield tv.

I use also an android box, mini m8s II (amlogic s905x) with moonlight and h.265.

Ethernet card on pc set to 100Mbps full duplex, because it gives me unplayable stutter if set to 1Gbps if video bitrate is set to more than 25Mbps only on amlogic s905x. With 100 Mbps i can go to 80Mbps bitrate with no problem. Really doubt that this is a problem with moonlight.

Everything else is already described on my posts above.

Everything that i find with my testing i´ll post it here. Thanks.

chicozeb commented 7 years ago

After a bit of testing with the witcher 3 and mass effect andromeda, i see that the stutters are gone and the latency is much improved. Testing with the mini m8s II android box, that has a video decoding latency of 44ms with h.265. 30 Mbps. Ethernet.

In mass effect andromeda, with the first no presentation time build, it would take something like half a second between button press and the character to jump. With this build feels almost instant. I press and the character jumps. And i'm using an xbox one s controller through bluetooh, so more latency added. Overall, i think it has a latency of 150ms, while the previous build had something like 500ms. Of course, this are estimates, and i'm far of being a machine...

More testing is necessary, but it's looking good.

Edit: After a few minutes of testing on shield tv, i see no difference between this build and the official nvidia games app.

Very good job. :)

redlight5 commented 7 years ago

There is definitely improvement with all the other changes included in this build. Latency is now bearable and I would say good enough for slower paced games (my ultimate test game is always Binding of Isaac, that game is tough with any lag and still too tough with this build). But great improvement, thanks!

JasonS7notG5 commented 7 years ago

Thanks for giving us the newest build with the fix. :) Feels better than the 5.0.1 based APK. When I stream in 720p 60fps mode (game running at 1080p 60fps) with USB tethering it feels almost 100% perfect (latency is 4ms). Streaming in 1080p 60fps increases the latency to 8ms (also in USB tethering mode), this is when it gets noticable so playing racing games or fast paced shooters is not really possible. On WiFi I get 5ms on 720p 60fps and 10ms on 1080p 60fps but latency is noticable on both scenarios but this may be my setup since I only have 60% signal strength (PC also on WiFi, not via Ethernet) and my WiFi stick has only one antenna while the S7 edge has 2 antennas (dual band). Well I guess I need to reposition my router and buy a better WiFi stick and maybe connect my PC via Ethernet for the best results.

When will you implement this fix in the official build? And is there no source code anymore since v5.0.0? I ask because I would like to see this fix included in Stream Theater and VRidge which make use of Moonlight.

cgutman commented 7 years ago

@JasonS7notG5 I'm not sure that the version of the fix here is shippable in a real release. I don't think I would like to regress latency as badly as the fix does. I'm trying to find a way to get the same frame pacing improvements without stuffing the rendering queue and increasing latency.

Source for official builds is still being pushed to the repo here as always. I haven't been publishing APKs here, but I'll get back on that for v5.1.

chicozeb commented 7 years ago

@cgutman Maybe you can add the fix on moonlight settings like an selectable option. Like:"select this option to reduce stuttering at expense of latency" or something like that. I have no idea if it´s possible or if the setting must be enabled during instalation.

I´m saying this because most people probably cannot find this thread and thus cannot use this fix. While installing .apk is easy for some, i´m sure there are people that have some difficulties. And then, if they find stuttering they simply think that your software is not very good and don´t use it.

Of course, this only while you can´t fix the stuttering by other means.

But i cannot find any latency difference between this build and the official nvidia gamestream app when i run moonlight on shield tv ethernet connected. Maybe it´s there, but i cannot notice it. And i think that´s a good thing.

JasonS7notG5 commented 7 years ago

I am hoping that you will find a better way to eliminate the micro stutters without increasing latency. Looking forward to that day. :P

devilxxmaster commented 7 years ago

Me pasa igual, tengo un equipo bastante potente he probado con una tablet Lenovo Yoga Tab 3 Plus con 8 procesadores y 3gb de RAM, y tengo un lag imposible de mantener. La tablet tiene Android 6.0.1 , sin embargo, tengo un Samsung Galaxy S7 Edge con Android 7.0 , y en este funciona perfectamente... He probado bastantes cosas pero nada. Antes de encontrar este post hice este vídeo: https://youtu.be/FUDQflHbMeM Después encontré este post y estoy viendo que es un bug (por lo que puedo deducir por lo que leo aquí con mi pobre nivel de ingles) Todo mi apoyo a los desarrolladores y espero que lo solucionen pronto porque la app me encanta. Ya he probado a reinstalar los drivers nvidia con una instalación limpia, habiendo pasado el 3dguru, y he probado las otras dos versiones de la aplicación del post, pero no se soluciona.

Siento escribir en español pero mi nivel de ingles escrito es demasiado bajo.

It happens to me, I have a pretty powerful computer I have tried with a tablet Lenovo Yoga Tab 3 Plus with 8 processors and 3gb of RAM, and I have a lag impossible to maintain. The tablet has Android 6.0.1, however, I have a Samsung Galaxy S7 Edge with Android 7.0, and in this works perfectly ...I have tried quite a few things but nothing. Before finding this post I made this video:Https://youtu.be/FUDQflHbMeMThen I found this post and I'm seeing that it is a bug (so I can deduce from what I read here with my poor level of English)All my support for the developers and I hope they solve it soon because the app I love.I have already tried to reinstall the nvidia drivers with a clean installation, having passed the 3dguru, and I have tried the other two versions of the application of the post, but it is not solved.I'm sorry to write in Spanish but my level of written English is too low.

PhantomLiberty commented 7 years ago

Newest fixed build doesn't change the latency at all from the first one. Tested with USB tethering. Still getting anywhere from 18-26 ms of lag at 1080p/60 but it feels like way more. Framerate is still smooth as hell which is great but the lag kinda kills it. Mainly because I can get 5-8ms at 1080p/60 on the other builds which feels virtually lagless.

I will be so happy if one day we can get the best of both worlds with low latency and smooth video playback.

JasonS7notG5 commented 7 years ago

I hope the devs didn't put on hold or abandoned the work for the micro stutter fix (without increasing latency). I don't know how Moonlight exactly works but maybe it needs to be updated on par with the newest GameStream app from NVIDIA since Moonlight is a reverse engineered app from that one. And GeForce Experience got an update which has "reduced video stutter by matching monitor refresh rates of client and server". Maybe have a look at it and update Moonlight if possible please.

PhantomLiberty commented 7 years ago

Any progress on this matter?

As smooth as the fixed build is I still can't bring myself to use it because of the lag. Opposite for the Play Store version, can't bring myself to play with it because of the annoying stutter but the low latency is nice.

cgutman commented 6 years ago

Here's a v5.2.1 with the microstutter hack - https://drive.google.com/open?id=0B_5O1xNt8Q9lUEZtbFNkT3c2RWs

I'm going to just include an advanced option for it in the next build.

BParks21 commented 6 years ago

@cgutman I also have this issue on a standard Galaxy S7 and an Axon 7. It's literally the only thing preventing moonlight from being an enjoyable experience. The hack eliminates the microstutter/frame pacing issue but the extra input lag is unbearable. Please i'm begging the devs to make a proper fix for this one of your main priorities because it's a real shame and makes it all to good to be true.

kbauer commented 6 years ago

I did some more testing on this issue.

I.e. either specifically the Galaxy S7 or Android 6 or newer (Axon 7 mentioned above) seems to "do" something every 3 seconds on the mobile network hardware, that interferes with live streaming.

jaysharp29 commented 6 years ago

There are a couple different things happening at the same time which conflate these issues.

Not all phones refresh at a flat 60hz. My moto g4 uses a lower 59hz and moonlight doesn't support variable framerates. Every one of my phones that uses a proper 60hz works with the "never drop frames" setting, but not the g4. It will drop a frame at 60fps nonstop.

This issue was brought up to the developers of vridge, and they fixed it right away. I'm not sure moonlight will ever get the ability.

Also, gamestream forces vsync on, and even the shield suffers frame skip when the host and client don't stream at the exact refresh. Gamestream doesn't offer a headless mode, which would probably help.

Finally, almost all lollipop os phones work flawlessly. I downgraded a phone from marshmallow to lolipop and all problems went away. Not a skip in sight. Too bad newer hardware doesn't support lollipop.

kbauer commented 6 years ago

@jaysharp29 In checked by using www.displayhz.com.

iPad Air 2 and Moto G, where streaming works regardless of mobile network connection, have a refresh rate of 60Hz straight.

For the Galaxy S7 an odd refresh rate of 59.67Hz is reported, which would correspond to a mismatch of one frame per 3 seconds (and 3 seconds is the observed stutter interval). No idea though how this fits with the issue vanishing upon using flight mode which, as expected, doesn't affect the refresh rate.

jaysharp29 commented 6 years ago

I don't know how flight mode affects the hardware. But the odd refresh is fixable by the developers. Moonlight doesn't have to request 60fps. Trinus, vridge, even kinoconsole allow customizable fps.

saiotek commented 6 years ago

I have the same problems with my z3 tablet. Downgraded to 5.1.1 and the microstuttering is gone, but some other framedrop is still there. Displayhz.com says 59.39hz So i changed 60 to 59 in the config, build the app and set the game to 59 on the host pc and now it's hard to find framedrops. Decoding numbers changed from 30ms to under 20ms

The problem i see with customisable fps, you have to set it in moonlight and on the host pc...

jaysharp29 commented 6 years ago

Can a 59hz build be uploaded?

saiotek commented 6 years ago

I can upload the build, have to get some freespace first. i deinstalled the original moonlight. I use the msi afterburner with rivatunner to set the fps to 59. There is although an option for 50fps.

saiotek commented 6 years ago

https://mega.nz/#!hmwEWboS!ov4twzICDX6cm52FQVRjurfkj1BGARq-Dye5JdmZRLA

Just for testing ;)

jaysharp29 commented 6 years ago

I'm trying to create one myself but can't figure out what in 'preferences' actually controls fps. Learning github and Android studio has been eye opening.

On Jan 2, 2018 2:35 PM, "saiotek" notifications@github.com wrote:

I can upload the build, have to get some freespace first. i deinstalled the original moonlight. I use the msi afterburner with rivatunner to set the fps to 59. There is although an option for 50fps.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/moonlight-stream/moonlight-android/issues/349#issuecomment-354868882, or mute the thread https://github.com/notifications/unsubscribe-auth/Abs1cORgm1Uac7bInRJgoYTiJ9SAeg00ks5tGpMkgaJpZM4MLaAj .

saiotek commented 6 years ago

config.fps see pull request #123

jaysharp29 commented 6 years ago

Almost perfect with the never drop frames settings.

Wonder what else could be done?

On Jan 2, 2018 3:18 PM, "saiotek" notifications@github.com wrote:

config.fps see pull request #123 https://github.com/moonlight-stream/moonlight-android/pull/123

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/moonlight-stream/moonlight-android/issues/349#issuecomment-354877769, or mute the thread https://github.com/notifications/unsubscribe-auth/Abs1cIbqaxF61YPy9zrCZ0uhHxDcTWZFks5tGp0-gaJpZM4MLaAj .

jaysharp29 commented 6 years ago

Using rtss with a custom 58.993 limit brought the latency down to 13ms over wifi. That's after creating a refresh of 59.000 in nvidia custtom settings.

So I hope this option is somehow pushed to main, because new gfe will probably stop this from working in the long run.

saiotek commented 6 years ago

It should be easy to just make an option under the microstutter fix like manual fps override where you can choose none (default), 50fps, 59fps and this overrides the config.fps for all resolutions...

BParks21 commented 6 years ago

This won't help for emulation. Games running through emulation need to maintain their target framrate in order to achieve full game speed, i wouldn't settle with this kind of fix.

jaysharp29 commented 6 years ago

That would be excellent, although like you said, it requires instructions on the host machine. My diy vr experience is pretty much flawless now.

@cgutman, any chance?

On Jan 3, 2018 4:08 AM, "saiotek" notifications@github.com wrote:

It should be easy to just make an option under the microstutter fix like manual fps override where you can choose none (default), 50fps, 59fps and this overrides the config.fps for all resolutions...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/moonlight-stream/moonlight-android/issues/349#issuecomment-354975808, or mute the thread https://github.com/notifications/unsubscribe-auth/Abs1cGDz_gIZESFF1m-pjiHPYRVPAyxbks5tG1GRgaJpZM4MLaAj .

jaysharp29 commented 6 years ago

The streaming quality itself vastly improves just picking the correct refresh rate. Unless android has the ability to correct or use adaptive sync, how else could they solve this?

But yes, not everything likes an odd refresh.

BParks21 commented 6 years ago

So what happens if the refresh rate remains 60 on the host machine and the fps is limited to 59 for the stream, does stutter still occur?

jaysharp29 commented 6 years ago

Haven't tried it. Any emulator in particular you're curious about? I have dolphin.

On Jan 3, 2018 4:53 AM, "WizardLizard" notifications@github.com wrote:

So what happens if the refresh rate remains 60 on the host machine and the fps is limited to 59 for the stream, does stutter still occur?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/moonlight-stream/moonlight-android/issues/349#issuecomment-354984614, or mute the thread https://github.com/notifications/unsubscribe-auth/Abs1cItWi-tgedrqtB-7bn_VQZL4up4Nks5tG1xBgaJpZM4MLaAj .

BParks21 commented 6 years ago

A few actually. The ones that aren't capable of running on a phone with raw emulation. Like PCSX2, CEMU, and yeah Dolphin even though it's getting there.

jaysharp29 commented 6 years ago

I'll try dolphin and pcsx2.

On Jan 3, 2018 5:05 AM, "WizardLizard" notifications@github.com wrote:

A few actually. The ones that aren't capable of running on a phone with raw emulation. Like PCSX2, CEMU, and yeah Dolphin even though it's getting there.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/moonlight-stream/moonlight-android/issues/349#issuecomment-354986854, or mute the thread https://github.com/notifications/unsubscribe-auth/Abs1cJHxa0BdrepwP0H2rj8X6rIiWfVCks5tG18UgaJpZM4MLaAj .

jaysharp29 commented 6 years ago

Doesn't work in dolphin. It's the reverse of regular moonlight now, 60 in, 59 out, a skip every frame. Some games have variable fps, but this isn't an emu fix, at least for dolphin.

On Jan 3, 2018 5:05 AM, "WizardLizard" notifications@github.com wrote:

A few actually. The ones that aren't capable of running on a phone with raw emulation. Like PCSX2, CEMU, and yeah Dolphin even though it's getting there.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/moonlight-stream/moonlight-android/issues/349#issuecomment-354986854, or mute the thread https://github.com/notifications/unsubscribe-auth/Abs1cJHxa0BdrepwP0H2rj8X6rIiWfVCks5tG18UgaJpZM4MLaAj .

jaysharp29 commented 6 years ago

Are you sure your phone even uses lower 59hz? This is only a fix in that situation, unless you prefer 50fps.

On Jan 3, 2018 5:38 AM, "Jacob Shaw" ja.shaw29@gmail.com wrote:

Doesn't work in dolphin. It's the reverse of regular moonlight now, 60 in, 59 out, a skip every frame. Some games have variable fps, but this isn't an emu fix, at least for dolphin.

On Jan 3, 2018 5:05 AM, "WizardLizard" notifications@github.com wrote:

A few actually. The ones that aren't capable of running on a phone with raw emulation. Like PCSX2, CEMU, and yeah Dolphin even though it's getting there.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/moonlight-stream/moonlight-android/issues/349#issuecomment-354986854, or mute the thread https://github.com/notifications/unsubscribe-auth/Abs1cJHxa0BdrepwP0H2rj8X6rIiWfVCks5tG18UgaJpZM4MLaAj .

BParks21 commented 6 years ago

It's like 59.67 or something.

jaysharp29 commented 6 years ago

Perhaps the phone can use all refresh below 60 and it will work. This only works with "never drop frames".

On Jan 3, 2018 5:43 AM, "WizardLizard" notifications@github.com wrote:

It's like 59.67 or something.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/moonlight-stream/moonlight-android/issues/349#issuecomment-354993269, or mute the thread https://github.com/notifications/unsubscribe-auth/Abs1cId4L3b6Xbin1qzUqsS6UIv8Qzcsks5tG2fhgaJpZM4MLaAj .

jaysharp29 commented 6 years ago

To get the lowest latency, I have to switch to 59hz refresh on host pc after connecting. So you should sync at 60hz and then pick a 59hz resolution.

Starting the host pc with 59hz gives me 20ms.

BParks21 commented 6 years ago

Not all games detect a 59hz signal even steam games. For example Star Ocean The Last Hope and Cuphead.

kbauer commented 6 years ago

Additionally, the frame rate mismatch issue is probably separate from the Galaxy S7 [Edge] issue, given that for the S7 stuttering vanishes in Flight mode.

By the way, can another S7 / S7 Edge owner confirm this behaviour? To reproduce: Enable flight mode, then reenable ONLY wifi.

BParks21 commented 6 years ago

I'll test It

On Jan 4, 2018 6:06 AM, "Klaus-Dieter Bauer" notifications@github.com wrote:

Additionally, the frame rate mismatch issue is probably separate from the Galaxy S7 [Edge] issue, given that for the S7 stuttering vanishes in Flight mode.

By the way, can another S7 / S7 Edge owner confirm this behaviour? To reproduce: Enable flight mode, then reenable ONLY wifi.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/moonlight-stream/moonlight-android/issues/349#issuecomment-355255771, or mute the thread https://github.com/notifications/unsubscribe-auth/ALnclijB9hZhkPFkKApY8e3K71Kgs6Cyks5tHLCXgaJpZM4MLaAj .

jaysharp29 commented 6 years ago

Flight mode disables the radio, which leads to power savings. Maybe the s7 uses more aggressive display sync when the data services are disabled.

As long as the phone actually uses the upper range of 59-60hz, you're probably right about it being a different issue.

kbauer commented 6 years ago

Apparently, setting the screen-resolution to HD = 1280x720 removes the stuttering for the Galaxy S7. Definitely more viable than using flight mode, though the solution still doesn't make sense to me...

This can be achieved by using the "Performance Mode" setting in the notification-bar menu, by customizing the settings of one of the modes accordingly. It doesn't matter if one uses "Game Mode" or "Performance Mode" for this.

According to displayhz.com, this doesn't affect the refresh rate.

screenshot_20180105-011814: Press and hold "Performance Mode" button. Press "Game". Press "Customize". Select "HD" screen resolution, then press "Apply".

I switched a couple of times, and tried several "resolution and framerate"-targets. Apparently nothing other than selecting "HD" helps. E.g. setting the resolution to Full HD and the resolution target to "1080@60Hz", produces the same stuttering, as setting to resolution to WQHD (native resolution) with "720@30Hz".

In some cases, I had to restart the game after changing the resolution, as otherwise the software would reject the connection.

Can someone else with an S7 (Edge) comment on whether this solves the issue for them?

Update 2018-01-13: For some reason the screen-resolution method no longer works for me. Flight-mode still works.

jaysharp29 commented 6 years ago

Did you ever try the refresh fix? 720p on an s7 is a big compromise.

kbauer commented 6 years ago

Probably relevant: I had "Never drop frames" disabled during my recent tests (Flight Mode, HD resolution).

@jaysharp29

720p. Not much of a compromise on the S7, since Samsung bundles software to quickly switch these settings right into the notification bar. Worst-case I'll forget to switch off game-mode, and will have to disable it (takes a few seconds) once I notice the blurryness. Once set up, it is a single press of the notification-bar button.

Refresh fix. I am currently trying to build moonlight myself, will give further feedback once I got it to work.

BParks21 commented 6 years ago

@kbauer So with flight mode on and never drop frames disabled you can leave the phone resolution above 720p with no microstutter?