tildearrow / kwin-lowlatency

archived - X11 full-screen unredirection and lots'a settings for KWin
373 stars 10 forks source link

Audio out of sync #100

Closed Quppa closed 3 years ago

Quppa commented 3 years ago

Software: KDE Plasma 5.20.1, Fedora 33, Qt 5.15.1, Kernel 5.8.15 (but was also happening under KDE Plasma 5.19/Fedora 32/Qt 5.14) Hardware: Intel i7-2600K, AMD Radeon RX 570

When running the KWin-lowlatency fork, my system's audio seems to be out of sync by a very small but consistent amount. It seems to be application-independent - Firefox, VLC and mpv all behave the same, with or without hardware acceleration.

I recorded at 120 fps this 59.94 fps video (from PhotoJoseph.com) playing on my 60 Hz monitor to try and demonstrate the issue:

I zoomed in on the waveform display in Kdenlive and selected a similar point, just as a beep is happening. With KWin-lowlatency, the display shows +8, while with standard KWin it shows +4.

KWin: image

KWin-lowlatency: image

tildearrow commented 3 years ago

This appears to be an audio latency issue, rather than a video latency one (positive values mean that the audio is too late). Indeed, it appears kwin-lowlatency is doing its job right, by actually increasing the value from +4 to +8.

I just ran the test (using mpv, JACK (buffer size 128 at 44100Hz with 2 periods which means ~2.9-5.8ms of latency), the PulseAudio JACK sink and a monitor which has exactly 10ms of input lag according to displaylag.com. Under this setup, I am getting -1 (this would perhaps be 0 if game mode is enabled on the monitor (disables extra processing to reduce latency)).

Are you using PulseAudio directly or JACK/ALSA/something? How are you outputting sound (HDMI or analog)?

Quppa commented 3 years ago

Hm, thanks, you're quite right about the audio being late - is KWin's extra latency actually helping me out here? :)

I'm using PulseAudio (13.99.2) with whatever defaults Fedora 33 provides. I'm outputting sound to a class 1 USB DAC.

I'll close this since it seems this isn't a KWin-lowlatency issue (I guess it just exposes the issue better).