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

Reverting Resolution after 120 seconds #74

Open
bayramog opened this issue Aug 9, 2024 · 5 comments
Open

Reverting Resolution after 120 seconds #74

bayramog opened this issue Aug 9, 2024 · 5 comments

Comments

@bayramog
Copy link

bayramog commented Aug 9, 2024

Hello,

Thanks for all your automation scripts which make Moonlight + Sunshine experience more seamless for us! I have very basic setup with MonitorSwapper and ResolutionAutomation. Firstly my MonitorSwapper changes my monitor to a Dummy one which is a working automation. Then ResolutionAutomation changes my resolution to desired state. Which is again working. So I can enter with my setup to desired monitor and resolution. But since I dont end stream, while in the stream ResolutionAutomation revert its changes after 120 seconds which is delay timeline for Sunshine suspension. The odd thing is I am still in the stream and there is no suspension on Sunshine. Also MonitorSwapper acts same as ResolutionAutomation. After its delay it also changes to primary screen since I am in the stream. Cannot solve the issue own by own. Here is the log for ResolutionAutomation.


Windows PowerShell transcript start
Start time: 20240809140700
Username: GamingOS\bayramog
RunAs User: GamingOS\bayramog
Configuration Name:
Machine: GamingOS (Microsoft Windows NT 10.0.22631.0)
Host Application: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File C:\ResolutionMatcher\ResolutionMatcher.ps1 -async True
Process ID: 29604
PSVersion: 5.1.22621.3958
PSEdition: Desktop
PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.22621.3958
BuildVersion: 10.0.22621.3958
CLRVersion: 4.0.30319.42000
WSManStackVersion: 3.0
PSRemotingProtocolVersion: 2.3
SerializationVersion: 1.1.0.1


Transcript started, output file is .\log.txt

Id Name PSJobTypeName State HasMoreData Location Command


1 ResolutionMa... BackgroundJob Running True localhost ...
3 ResolutionMa... BackgroundJob Running True localhost ...
Waiting for the next event to be called... (for starting/ending stream)
Processing event: Start
Before Override: 3840 x 2160 x 120
After Override: 3840 x 2160 x 120
Setting screen resolution to 3840 x 2160 x 120
Resolution changed successfully.
Still waiting for the next event to fire...
Processing event: End
Setting screen resolution to 1920 x 1080 x 120
Resolution changed successfully.


Windows PowerShell transcript end
End time: 20240809140903


This one for MonitorSwapper.


Windows PowerShell transcript start
Start time: 20240809140649
Username: GamingOS\bayramog
RunAs User: GamingOS\bayramog
Configuration Name:
Machine: GamingOS (Microsoft Windows NT 10.0.22631.0)
Host Application: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -Command & 'C:\MonitorSwapper\StreamMonitor.ps1' -scriptName MonitorSwapper -sib 1
Process ID: 8676
PSVersion: 5.1.22621.3958
PSEdition: Desktop
PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.22621.3958
BuildVersion: 10.0.22621.3958
CLRVersion: 4.0.30319.42000
WSManStackVersion: 3.0
PSRemotingProtocolVersion: 2.3
SerializationVersion: 1.1.0.1


Transcript started, output file is .\logs\log_1723212410.txt
Waiting for the next event to be called... (for starting/ending stream)
Processing event: Start
Dummy plug activated
Processing event: GracePeriodExpired
Stream has been suspended beyond the defined grace period. We will now treat this as if you ended the stream. If this was unintentional or if you wish to extend the grace period, please adjust the grace period timeout in the settings.json file.
INFO: System.Collections.Hashtable
INFO: Stream has ended, now invoking code
INFO: Primary monitor(s) have been successfully restored!


Windows PowerShell transcript end
End time: 20240809142202


@Nonary
Copy link
Owner

Nonary commented Aug 11, 2024

Did you change the default ports in Sunshine/Moonlight? That’s probably why this happens if I had to guess

@bayramog
Copy link
Author

Yes, I have changed them. Is there any process I can use both changed ports and your scripts?

@Nonary
Copy link
Owner

Nonary commented Aug 17, 2024

Yes, I have changed them. Is there any process I can use both changed ports and your scripts?

The only thing the script does to verify connectivity is to check to see if Sunshine has a connection via UDP open, does not matter which port. So if it is disconnecting you early, then that would imply you are either only doing TCP via Sunshine or some weird interaction going on with something like a reverse proxy or whatever, not sure.

@bayramog
Copy link
Author

My host at Azure datacenter. Maybe it is the case. But before it was working. I will try it with default ports again to understand if it is the issue.

@Nonary
Copy link
Owner

Nonary commented Aug 18, 2024

I am not really sure how you can resolve this issue beyond changing the grace period setting in the settings.json file to a really large number, effectively disabling the feature.

Setting it to 2147483647 for example, that is the maximum allowed number which would wait 68 years before reverting.

There is something with your setup that is causing the UDP check to fail and think you’re not streaming at all, that could be security policies (could try running script as elevated) or just network configuration like i mentioned earlier.

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

No branches or pull requests

2 participants