Skip to content
This repository was archived by the owner on May 27, 2026. It is now read-only.
This repository was archived by the owner on May 27, 2026. It is now read-only.

Occasional observable micro-stutters when streaming #37

Description

@isundaylee

Describe the bug
I'm experiencing occasional microstutters when streaming game content from my PC desktop to my Mac client. The screen freezes very briefly causing a observable stutter before returning to normal. No frame drop is detected in the stats overlay. See below in the "Additional context" section for some troubleshooting I've tried so far.

Steps to reproduce
This happens every once in a while (from couple seconds to couple minutes) when I stream game from my PC to my host.

Affected games

Moonlight settings

  • Streaming with 1440p/60fps. I tried lowering resolution all the way down to 720p and lowering bitrate to 10Mbps and this issue still happens.
  • I tried with encoder setting set to H264/HVEC/auto, and this issue persists.
  • I tried enabling/disabling frame pacing, and this issue persists.
  • I tried enabling/disabling V-sync in both game and Parsec, and this issue persists.

Client PC details

  • OS: macOS Monterey 12.5
  • Moonlight Version: This repros with both release v4.1.0 and a Git build (based on 685136d9)
  • GPU: Intel Iris Plus Graphics 655 1536 MB
  • Client & server hosts are connected via 1Gbps ethernet directly onto the same switch (TL-SG108E).

Server PC details

  • OS: Microsoft Windows 10 Home 10.0.19044
  • GeForce Experience Version: 3.25.1.27
  • Nvidia GPU driver: 516.59
  • Antivirus and firewall software: Just default Windows 10 settings

Moonlight Logs (please attach)

Attached. Log contains some additional debug information I added, including slow frame logs (https://github.com/isundaylee/moonlight-qt/tree/my-custom-changes).

Also attached two packet captures (on host and client respectively) that cover a subset of time period in the log. See "Additional context" below for more info.

moonlight.log
pcaps.zip

Additional context

The game itself is FPS-locked to 60, with the MSI Afterburner perf overlay showing a steady 60FPS when this happens. GPU usage is between 40-50% and CPU usage is between 10-20%. Hardware-accelerated GPU scheduling is turned off (though this repros when it's turned on too).

I tried the following to debug this issue:

I added some debug logging in FFmpegVideoDecoder::submitDecodeUnit to detect/alert on frames that arrive later than the expected 16-17ms since the previous frame. The microstutter I observe corresponds pretty well to the slow frames detected/logged. e.g.:

00:08:12 - 2022/08/04-23:58:54,494 - SDL Info (0): Slow frame 28913 elapsedTicks 32

^ Note that elapsedTicks is 32 which is much higher than the expected 16-17 for 60fps.

When this happens, Moonlight still receives a steady 60-61 fps. So this doesn't look like frame dropping - more like weird frame pacing.

To exclude networking as a potential issue, I took two packet captures simultaneously on my host (pc.pcap) and my client (mac.pcap). I'm able to observe the same higher-than-normal delay between frames in both packet captures, which suggests that the frame delay already exists when the host sends out the data packets.

e.g., this line in the log:

00:08:12 - 2022/08/04-23:58:54,494 - SDL Info (0): Slow frame 28913 elapsedTicks 32

corresponds to the 0.031 seconds jump between the frame comprising of RTP seq nums 15879-15882 and the frame starting on RTP seq num 15883 (for port 47998). You can see it in pc.pcap by comparing the timestamps of packet 12317 and packet 12333, and in mac.pcap by comparing the timestamps of packet 14072 and packet 14088. I also confirmed that these two frames have sequential frameIndex (as defined in NV_VIDEO_PACKET), so no frame dropping.

Note on the packet captures: There's some timestamp drift between the server and the client, but the timestamps in Moonlight log corresponds pretty well to the timestamps in mac.pcap.

Any potential idea/suggestion is appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions