LizardByte / Sunshine

Self-hosted game stream host for Moonlight.
http://app.lizardbyte.dev/Sunshine/
GNU General Public License v3.0
15.41k stars 743 forks source link

[macOS] Stream artificially limited to 90fps when set to 120fps in Moonlight #2745

Open louis-pre opened 1 week ago

louis-pre commented 1 week ago

Is there an existing issue for this?

Is your issue described in the documentation?

Is your issue present in the latest beta/pre-release?

Describe the Bug

I have a tablet (Samsung Tab S9+) capable of 120hz refresh rate on which I run Moonlight. Connecting it to my Macbook Pro M1 host works but the fps does not reach 120fps. Instead, it stays at a steady 90 fps.

Screenshot_20240623_032343_Moonlight (Debug)

Expected Behavior

The macOS Sunshine host provides 120fps when the client requests it.

Additional Context

Troubleshooting done:

Host Operating System

macOS

Operating System Version

Sonoma 14.5

Architecture

arm

Sunshine commit or version

v2024.621.193854

Package

macOS - Homebrew

GPU Type

n/a

GPU Model

N/A

GPU Driver/Mesa Version

N/A

Capture Method

None

Config

output_name = 3
hevc_mode = 2
fps = [30,60,90,120]
resolutions = [
    1280x720,
    1920x1080,
    2560x1440,
    1920x1200,
    2560x1600,
    1280x800
]
origin_web_ui_allowed = pc

Apps

No response

Relevant log output

[2024:06:23:03:10:37]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2024:06:23:03:10:37]: Info: Trying encoder [videotoolbox]
[2024:06:23:03:10:37]: Info: Detecting displays
[2024:06:23:03:10:37]: Info: Detected display: Built-in Retina Display (id: 1) connected: true
[2024:06:23:03:10:37]: Info: Detected display: 28E850 (id: 3) connected: true
[2024:06:23:03:10:37]: Info: Configuring selected display (3) to stream
[2024:06:23:03:10:37]: Info: SDR color coding [Rec. 601]
[2024:06:23:03:10:37]: Info: Color depth: 8-bit
[2024:06:23:03:10:37]: Info: Color range: [JPEG]
[2024:06:23:03:10:37]: Warning: [h264_videotoolbox @ 0x107b2df90] PrioritizeEncodingSpeedOverQuality property is not supported on this device. Ignoring.
[2024:06:23:03:10:37]: Info: [h264_videotoolbox @ 0x107b2df90] This device does not support the AllowOpenGop option. Value ignored.
[2024:06:23:03:10:37]: Info: SDR color coding [Rec. 601]
[2024:06:23:03:10:37]: Info: Color depth: 8-bit
[2024:06:23:03:10:37]: Info: Color range: [JPEG]
[2024:06:23:03:10:37]: Info: SDR color coding [Rec. 601]
[2024:06:23:03:10:37]: Info: Color depth: 8-bit
[2024:06:23:03:10:37]: Info: Color range: [JPEG]
[2024:06:23:03:10:37]: Error: Couldn't open [av1_videotoolbox]
[2024:06:23:03:10:37]: Info: Detecting displays
[2024:06:23:03:10:37]: Info: Detected display: Built-in Retina Display (id: 1) connected: true
[2024:06:23:03:10:37]: Info: Detected display: 28E850 (id: 3) connected: true
[2024:06:23:03:10:37]: Info: Configuring selected display (3) to stream
[2024:06:23:03:10:37]: Info: SDR color coding [Rec. 709]
[2024:06:23:03:10:37]: Info: Color depth: 10-bit
[2024:06:23:03:10:37]: Info: Color range: [JPEG]
[2024:06:23:03:10:38]: Info: 
[2024:06:23:03:10:38]: Info: // Ignore any errors mentioned above, they are not relevant. //
[2024:06:23:03:10:38]: Info: 
[2024:06:23:03:10:38]: Info: Found H.264 encoder: h264_videotoolbox [videotoolbox]
[2024:06:23:03:10:38]: Info: Found HEVC encoder: hevc_videotoolbox [videotoolbox]
[2024:06:23:03:10:38]: Info: Executing [Desktop]
[2024:06:23:03:10:38]: Info: CLIENT CONNECTED
[2024:06:23:03:10:38]: Info: Detecting displays
[2024:06:23:03:10:38]: Info: Detected display: Built-in Retina Display (id: 1) connected: true
[2024:06:23:03:10:38]: Info: Detected display: 28E850 (id: 3) connected: true
[2024:06:23:03:10:38]: Info: Configuring selected display (3) to stream
[2024:06:23:03:10:38]: Info: SDR color coding [Rec. 709]
[2024:06:23:03:10:38]: Info: Color depth: 8-bit
[2024:06:23:03:10:38]: Info: Color range: [MPEG]
[2024:06:23:03:10:38]: Error: opening microphone '' failed. Please set a valid input source in the Sunshine config.
[2024:06:23:03:10:38]: Error: Available inputs:
[2024:06:23:03:10:38]: Error:   MacBook Pro Microphone
[2024:06:23:03:10:38]: Error: Unable to initialize audio capture. The stream will not have audio.
ReenigneArcher commented 1 week ago

There is a new config option to adjust the minimum fps factor.

Sunshine streams at a lower FPS when it detects frames are changing less frequently.

louis-pre commented 1 week ago

There is a new config option to adjust the minimum fps factor.

Sunshine streams at a lower FPS when it detects frames are changing less frequently.

I forgot to mention it in my post, I have tried some troubleshooting of the variable refresh rate using the "technique" I use on Windows hosts, aka moving my mouse really fast. The fps stays at a steady 90fps (it also does not drop below 90 like it does on a Windows host).

I did not know about that setting, you're referring to Minimum FPS Factor correct? If so, I just tried with the values 1,2,3,10,120 with no effect on the stream's fps (as in, it remains at 90fps). I tried with both the native display and my external display using 1080p resolution.

edit: I redid my test using blur busters' UFO test to make sure the results I am getting are not due to my unorthodox testing methology.

Hazer commented 6 days ago

@louis-pre @ReenigneArcher I'm on Intel mac, but I'll have a first look at it and see if I can find anything. What happens if you set the FPS and min FPS to 40? Does it work or it fallbacks to 90 or even 60?

Don't wait for me tho, I won't be able to pay enough attention to it this week, so if anyone finds something first, go for it.

louis-pre commented 6 days ago

@louis-pre @ReenigneArcher I'm on Intel mac, but I'll have a first look at it and see if I can find anything. What happens if you set the FPS and min FPS to 40? Does it work or it fallbacks to 90 or even 60?

Don't wait for me tho, I won't be able to pay enough attention to it this week, so if anyone finds something first, go for it.

I'll try that this evening. I did try 60fps and it worked if I remember correctly though. I also have an Intel Mac and can do a comparison (although its screen is 60Hz).

louis-pre commented 6 days ago

@Hazer

40fps is not supported by the Android app so I tested on my Steam Deck instead (which supports up to 90Hz).

Setting the fps target to 40 in Moonlight gives me a stable 40fps out of the M1 Mac host (stable, as in it does not drop like on a Windows host). I also tested 120fps target on the Deck and got 90fps from the M1 Mac host too.

I don't know how to set the minimum fps so I did not try that.

edit: I tested streaming from my Intel Mac and observed the same problem (I used out of the box settings on Sunshine). 40fps -> Sunshine provided 40fps 60fps -> Sunshine provided 60fps 90fps -> Sunshine provided 90 fps (even though I used the native 60Hz screen) 120fps -> Sunshine provided 90fps again

Hazer commented 5 days ago

@louis-pre thanks for the detailed report, that will help me a lot.