Repository navigation
Why is there persistent audio latency while streaming? #141
Persistent 350–450 ms Audio Latency with Windows 11 + SunshineMoonlight Version
Device
Host
Network
Bug DescriptionThere is a persistent approximately 350–450 ms audio delay when streaming Windows audio from Sunshine to Moonlight Tizen on this Samsung TV. The delay is present even when the streamed display contains no video content relevant to the audio. The laptop's local speaker and the TV speaker can reproduce the same audio simultaneously, making the delay directly audible. Reproduction
The same behavior was observed with YouTube audio playing in the Brave browser while the TV was displaying only an empty desktop. Important Observation: Delay Does Not Depend on Video ContentThe delay occurs when:
The delay is therefore reproducible without requiring video frames corresponding to the audio. This suggests that the problem can be investigated as an audio transport/decode/buffering/rendering latency issue rather than as a conventional audio/video synchronization problem. Control TestsMoonlight for WindowsAnother Windows PC running Moonlight for Windows against the same Sunshine host did not show an obvious comparable audio delay. MiracastThe same general PC/network/TV hardware was also tested using Windows Miracast. A YouTube 25-second synchronization test played through Miracast showed the sound occurring essentially at the 0 ms point of the test scale, with no noticeable 350–450 ms delay. This suggests that the TV hardware itself is capable of essentially synchronized audio playback. NetworkThe problem remained with Ethernet connections and very low network latency. Therefore ordinary network RTT does not appear sufficient to explain the approximately 350–450 ms delay. Steam Streaming SpeakersSteam Streaming Speakers was installed and selected as the Sunshine audio endpoint. The delay remained approximately 350–450 ms. Therefore changing the Windows audio output endpoint from the normal Realtek speaker endpoint to Steam Streaming Speakers did not eliminate the delay. Expected BehaviorAudio received by Moonlight Tizen should have low enough latency that it is reasonably synchronized with the same audio being played locally on the Windows host. Other clients and Miracast on the same general hardware demonstrate that substantially lower latency is possible. Actual BehaviorMoonlight Tizen consistently produces approximately 350–450 ms of additional audio latency under the conditions described above. The delay is sufficiently large to be clearly audible when comparing the PC and TV speakers simultaneously. Additional InformationThe primary reproduction test is intentionally based on: MP3/music playback + empty desktop streaming This removes video content as a likely confounding factor while keeping the Moonlight streaming session continuously active. I would appreciate any guidance on:
I can provide further controlled test results if useful. |
Replies: 7 comments
Additional measurement results — separating Moonlight-Tizen processing from downstream TV audio latencyI performed additional instrumentation of the Moonlight-Tizen audio path to determine how much of the measured PC-speaker → TV-speaker delay occurs inside the Moonlight application itself. The measurements were made using the same test environment described in the original post. 1. External measurement: PC speaker → TV speakerI used an iPhone recording while the same short "ding" sound was played through:
Repeated measurements gave approximately:
These measurements are substantially more repeatable than my earlier rough estimates. 2. Internal Moonlight-Tizen measurementI then added instrumentation at several points in the Moonlight-Tizen audio pipeline:
The measured Point-A → Point-C time was: EMSS: Web Audio: The EMSS measurement was observed over an extended run. Individual averages varied somewhat with time (for example, ~0.5 ms initially, ~7.4 ms after 10 minutes, and ~4.6 ms after 20 minutes), but remained very small compared with the approximately 382 ms externally measured delay. 3. Estimated latency outside the measured Moonlight-Tizen boundaryUsing the corresponding measurements: EMSS: Web Audio: Therefore, the unexplained portion is approximately: As a practical estimate, I currently consider ~400 ms to be the "elephant" — a large latency component that I have not yet been able to locate or measure inside the available Moonlight-Tizen application boundaries. 4. Current interpretationThe results suggest that the large delay is not primarily caused by Moonlight's EMSS buffering/scheduling path, since the measured Point-A → Point-C-EMSS processing time is only a few milliseconds. The Web Audio renderer does add significant measurable latency (~112 ms), but this still leaves approximately 414 ms unexplained. I also previously tested Windows Miracast on the same general PC/TV setup. Miracast showed essentially no noticeable PC-speaker → TV-speaker audio delay, although its video presentation has noticeably higher video latency. A Windows Moonlight client connected to the same Sunshine host also did not show an obvious comparable audio delay. At this point I therefore cannot conclusively determine whether the remaining ~400 ms is:
The current measurements only establish that the large latency is not captured between Point-A and Point-C-EMSS when using EMSS. I am posting these measurements mainly so that other users/developers can compare their results and potentially reproduce the same behavior on other Samsung/Tizen models. |
|
Hi I can confirm I have exactly the same issue with a TQ75QN90F, I don't have precise timing but there is a distinct sound lag between my laptop and my TV with the same stream on both, 300ms seems legit here. |
|
Sorry for the late response. I was on vacation when this discussion was opened and haven't been available to properly look into it until now. Thank you for the detailed report and the additional instrumentation. The measurements are useful, especially the very small Point-A → Point-C time measured with EMSS compared with the much larger externally measured PC-speaker → TV-speaker delay. Some amount of latency between the host and client is expected. The PC will naturally produce the audio slightly earlier, while the TV still needs to receive, decode, buffer, process, and present the audio through its own media pipeline. On my Tizen 6.0 TV, this difference is barely noticeable during normal use. What is particularly interesting here is that both affected reports are from newer Tizen versions: Tizen 9.0 in the original report and probably Tizen 10.0 in the additional report. Starting with Tizen 9.0, there have been platform-level changes and known streaming-related issues involving Game Mode on Samsung TVs, which can affect streaming behavior in ways that are outside of Moonlight's control. These limitations are documented in the Known Issues & Limitations wiki page. The measurements also make it less likely that the large delay is being introduced by the EMSS processing path itself. A few milliseconds between receiving the audio and handing it to the Tizen audio subsystem cannot account for several hundred milliseconds of externally measured latency. That said, the current measurements cannot conclusively determine where the remaining latency is introduced. It could involve processing or buffering before the measured application boundary, or the Tizen TV audio and presentation pipeline after Moonlight hands the audio off. Before drawing a final conclusion, I would recommend trying different Moonlight streaming and audio settings to see whether the latency changes. In particular, please also try the experimental ForceGM variant if you have not already done so. This variant is intended for newer Tizen versions and may help determine whether the behavior changes. If possible, comparing EMSS and Web Audio with different jitter-buffer and streaming settings, as well as testing the ForceGM variant, would provide useful additional information. If the delay remains consistently in the same range across these configurations, that would further support the possibility that the additional latency is coming from the Tizen platform rather than from Moonlight's audio processing. |
|
Tried ForceGM variant v1.16.1, observed the same audio latency. |
|
Thanks for testing the ForceGM variant. Since the same audio latency is still present, I would like to do one more comparison before drawing a conclusion. Could you please install v1.15.0 and test the same scenario again? Since this version predates the introduction of the Web Audio backend, so the result should help determine whether the latency is related to the newer audio implementation or is present independently of it. Please let me know whether you notice any difference in the audio latency compared to v1.16.1/ForceGM, and provide the results. |
|
I tested v1.15.0 and https://github.com/ruanformigoni/moonlight-tizen v1.11.4 seperately before testing the combined version 1.16.0. |
|
Thanks for testing v1.15.0 as well. Since the same audio latency is present in v1.15.0, which predates the introduction of the Web Audio backend, this further rules out the newer Web Audio implementation as the cause. Combined with the same behavior on both the standard and ForceGM variants of v1.16.1, there does not appear to be anything further to investigate in Moonlight's audio processing. However, I cannot reproduce this behavior on my Tizen 6.0 TV. The issue therefore appears more likely to be related to changes or regressions in newer Tizen platform versions, particularly given that the reported case is on Tizen 9.0. As a workaround, I recommend using a Virtual Display Driver together with Steam Streaming Speakers for streaming, rather than comparing the host's physical audio output with the TV audio simultaneously. This avoids the additional host-side audio path and is the setup intended for streaming. Unfortunately, there is nothing further I can address from the Moonlight side, so I will close this discussion. |
Thanks for testing v1.15.0 as well.
Since the same audio latency is present in v1.15.0, which predates the introduction of the Web Audio backend, this further rules out the newer Web Audio implementation as the cause. Combined with the same behavior on both the standard and ForceGM variants of v1.16.1, there does not appear to be anything further to investigate in Moonlight's audio processing.
However, I cannot reproduce this behavior on my Tizen 6.0 TV. The issue therefore appears more likely to be related to changes or regressions in newer Tizen platform versions, particularly given that the reported case is on Tizen 9.0.
As a workaround, I recommend using a Virtual Display Driver toget…