Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
106.15k stars 10.28k forks source link

Help: last screen retention while returning to home/app drawer #1094

Open fefo-dev opened 4 years ago

fefo-dev commented 4 years ago

Had this happen for quite a while for me: when going back from an app all the way to the app drawer or home by middle click sometimes the last screen displayed stays on scrcpy. On the phone it works as expected, and clicks behave as intended so I can open another app without noticing. Normally I just click home a few times until it refreshes but I would like some help to debug this error.

Maybe lack of animations make so it doesn't refresh somehow? My phone has a clean, black home, all animations off, and runs Nova Launcher if it matters.

Much appreciated.

rom1v commented 4 years ago

Which scrcpy version? In particular, is it at least v1.10?

fefo-dev commented 4 years ago

Latest, but I remember it happening before.

rom1v commented 4 years ago

Could you record with scrcpy --record file.mp4, please?

When the screen is not up to date (not refreshed), close the window. Is the last frame visible in the recorded file? (if you play the file with vlc or firefox for example)

fefo-dev commented 4 years ago

Found a consistent way of triggering it by chance, and yes, it shows on the record. However, using the same method without turning the screen off does not cause the issue. Done several repetitions so far, and the behavior is consistent.

Is there a debug mode?

fefo-dev commented 4 years ago

About the test, I started a game on DraStic (Nintendo DS emulator) and hit quit as soon as I get something on screen. With screen on things behave as expected, but as soon as I turn it off (or from starting it off) the last frame stays on. Hitting middle-click (home) opens my app drawer, which probably triggers a redraw.

rom1v commented 4 years ago

However, using the same method without turning the screen off does not cause the issue.

Hmm. Might be related to #836.

Is there a debug mode?

Not really. You can build in debug instead of release, but it won't help you in that case.

Could you also test scrcpy --render-expired-frames?

One more test, a bit difficult to explain, but let's try. On my launcher, when I click to display the applications grid, the whole screen content changes at once, and stays static (it does not change anymore). This abrupt change typically results in a low quality frame.

But thanks to a flag (see DEVELOP, some new frames, encoding the same content, are sent, and we can see the quality improve automatically, even if the screen content does not change.

Could you see that effect (run with scrcpy -b1M to make it obvious)? And if you remove this line:

https://github.com/Genymobile/scrcpy/blob/31bd95022bc525be42ca273d59a3211d964d278b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java#L151

Could you see that the low-quality frame is kept as-is on the screen?

fefo-dev commented 4 years ago

My bad for the late response.

It seems related to the lack of new frames to update. I did a few tests with a live wallpaper and wasn't able to reproduce it, while even with --render-expired-frames it happened 100% of the time.

As I said before all animations are off on my phone, even Animator despite some bugginess. I still find it strange that it only happens on that transition, but there should be different rules in play here.

One more test, a bit difficult to explain, but let's try. On my launcher, when I click to display the applications grid, the whole screen content changes at once, and stays static (it does not change anymore). This abrupt change typically results in a low quality frame.

I wasn't able to notice or reproduce this behaviour, even on low bitrate. OS 'flavor' might be at fault here, mine is a version of LineageOS for Moto G5S.