Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove delay of getting device screen #93

Merged
merged 7 commits into from
Dec 7, 2024
Merged

Conversation

akshualy
Copy link
Contributor

@akshualy akshualy commented Dec 3, 2024

Implements screen recording to get live image data from the device. We record at ~30-60fps depending on device.

Normally, screen recording keeps the shell busy due to the constant stream of bytes. We work around that by loading off the recording and decoding into a separate asyncio task.
The shell may still be overwhelmed at times (usually roughly once an hour) and time out, but we have a catch mechanism in place and the session restarts properly.

While the implemented solution seems stable, I added the config option to disable this feature.
In the future, I know of a second workaround which reduces timeouts, but this needs a bigger code refactor to be properly implemented.

@akshualy akshualy added the enhancement New feature or request label Dec 3, 2024
@akshualy akshualy self-assigned this Dec 3, 2024
@rexlManu
Copy link

rexlManu commented Dec 4, 2024

A while ago for the last patch I also played around with adbblitz but I run into the issue in a fork of this bot where because of the many sleeps the screenshots were often out of sync with the real current image of the game. Also I keept running into that when running it with more then one device it's starts to really laag the game. Since this pass don't offer a duoq boost, that doesn't matter i guess.

@akshualy
Copy link
Contributor Author

akshualy commented Dec 4, 2024

because of the many sleeps the screenshots were often out of sync with the real current image of the game.

That's fortunately not the case with this approach, thanks to the recording happening in a different task. The only thing that may seem out of sync is that previously we tried to get the image as little as possible since screencap takes a while. We could increase the frequency of getting the screen now, but I'd want to make sure that it'd still run fine with screencap and that needs a code refactor.

Also I keept running into that when running it with more then one device it's starts to really laag the game.

I'll test this, thanks for letting me know.

Copy link
Contributor

@Kyrluckechuck Kyrluckechuck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense in theory and sounds like a good stepping stone that may (potentially) be sufficient to stop at! 🚀

@akshualy akshualy merged commit 7aa916c into main Dec 7, 2024
4 checks passed
@akshualy akshualy deleted the improve_screen_recording branch December 7, 2024 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants