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

[Issue]: Inputs freeze intermittently with a Bluetooth controller connected to the phone while streaming (sunshine host) #1395

Open
RadarNyan opened this issue Jul 18, 2024 · 9 comments
Labels

Comments

@RadarNyan
Copy link

RadarNyan commented Jul 18, 2024

Describe the bug

Input (phone touchscreen & Xbox controller connected to the phone via Bluetooth) would freeze randomly during streaming, but video/audio are not affected.

Steps to reproduce

  1. Start streaming with a Bluetooth controller connected to my phone, this would NOT create a virtual controller until I any button on the controller is pressed.
  2. Play a video on the PC as a reference for video/audio streaming status.
  3. Move the cursor by using the touch screen constantly, then press any button on the controller. As soon as I press the button, a "device connect" sound can be heard, as now the virtual game pad is connected and all inputs are frozen. Not even the touch screen would move the cursor anymore, while video/audio are not affected at all. I can move the mouse on the PC, so it's not Windows being frozen.
  4. Wait for a few seconds until the cursor can be moved again by the touchscreen, and then the controller will work with no issue as well.
  5. However, during the streaming, input would freeze randomly and then recover after a few seconds, which is very annoying.
  6. I have tried to repeat the above procedure on another laptop (running moonlight-qt) but can't reproduce the issue, which makes me think this might be an Android-specific issue.
  7. I do not have this "game controller freezes touchscreen" issue with any controller test app I can find, so it's unlikely to be a hardware problem of the phone.

Affected games

All.

Other Moonlight clients

PC

Moonlight adjusted settings

No

Moonlight adjusted settings (please complete the following information)

N/A

Moonlight default settings

Yes

Gamepad-related connection issue

No

Gamepad-related input issue

No

Gamepad-related streaming issue

Yes

Android version

Android 12

Device model

POCO X4 GT (Dimensity 8100)

Server PC OS version

Windows 10 21H2

Server PC GeForce Experience version

N/A

Server PC Nvidia GPU driver version

N/A

Server PC antivirus and firewall software

Windows defaults

Screenshots

No response

Relevant log output

Screenshot_2024-07-18-16-05-46-544-edit_com f0x1d logfox

Inputs freeze at the first log (about audio) and resumes at the last (so about 10 seconds.)

Additional context

I managed to find an OTG connector and connected the Xbox controller to the phone via USB, but I failed to reproduce the issue, so it's Bluetooth-specific.

I've tried to play the same games with the Steam Link app, and despite the horrible performance and messy steam input mapping system, I haven't experienced any freezing, so this can't be caused by "hardware limitation due to the antenna wiring" as mentioned in the moonlight-streaming troubleshooting page.

@RadarNyan RadarNyan added the bug label Jul 18, 2024
@RadarNyan RadarNyan changed the title [Issue]: Inputs freeze intermittently while streaming (sunshine host) [Issue]: Inputs freeze intermittently with a Bluetooth controller connected to the phone while streaming (sunshine host) Jul 18, 2024
@RadarNyan
Copy link
Author

image

I've been trying to track this down but do not have enough knowledge of Android development to make anything out of it. All I've found is that this problem is caused by some slow binder calls which block the ControllerHandler thread.

@ClassicOldSong
Copy link

You can try my fork that may have solved the issue: ClassicOldSong/moonlight-android/releases

Uncheck Enable battery status report for gamepad in the settings.

@ClassicOldSong
Copy link

Dupe #1389

@RadarNyan
Copy link
Author

You can try my fork that may have solved the issue: ClassicOldSong/moonlight-android/releases

Uncheck Enable battery status report for gamepad in the settings.

I just installed your fork and unchecked the option, but the problem persists. All inputs still hang for 10 seconds with the same slow binder log.

@RadarNyan
Copy link
Author

Thanks, @ClassicOldSong ! I managed to produce a duct tape fix by commenting out

private final HandlerThread backgroundHandlerThread;
private final Handler backgroundThreadHandler;

And every error lines caused by commenting out the above two lines in ControllerHandler.java, now the problem is gone.

@ClassicOldSong
Copy link

ClassicOldSong commented Jul 18, 2024

There was a typo in my commit, that option was not actually set... Just pushed a new release, you can try again...

The AI generated string didn't match the actual key of the checkbox...

@RadarNyan
Copy link
Author

There was a typo in my commit, that option was not actually set... Just pushed a new release, you can try again...

The AI generated string didn't match the actual key of the checkbox...

Yup, the new upload works.

@pgomezi
Copy link

pgomezi commented Sep 9, 2024

Thanks so much, @ClassicOldSong! I had been having the exact same issue for a month. Only with bluetooth controller, only on Android client, and server wasn't even Sunshine, just nvidia driver. Input freeze every few minutes for about 15 seconds, with the last inputs remaining stuck. I searched a lot and thought the github would have a newer Android client version than the play store but no, still 12.1, the same as over six months ago. But today thanks to your fork I never had that problem again, and found some nice advanced features as well. Awesome. Glad I found this page.

@JesterForPirate
Copy link

Exact same issue using the Nvidia Shield and after controlling the cursor using the Shield app on an android device.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants