Sometimes, when playing local audio files, regardless of system's load level, the audio playback momentairly stops and then resumes, it takes maybe less than 1s. This is happening on fully performance tuned Pipewire setup, and pwtop does not show any issues on pipewire side. I highly suspect elisa is simply running out of the input to play, and stutters when fetching next chunk from disk. Does elisa already have some kind of precaching system? Would it be acceptable to simply fully prefetch the whole file before playing, or is the filesize a concern? Something smarter, like ensuring that N next seconds are always avaliable could be nice, too.
Posted minimal fix at https://invent.kde.org/multimedia/elisa/-/merge_requests/397 I don't know if this fully solves the problem for me, but if it does not, the next step would be forcing the kernel to prefetch the whole file...
Git commit 7848ea003340ce1e7269e3fa96396eaf17e3e77d by Nate Graham, on behalf of Roman Lebedev. Committed on 14/11/2022 at 17:29. Pushed by ngraham into branch 'master'. Set libvlc playback cache size to 10 seconds (#461299) The most common use-case for Elisa is to start playing something, and let it play without jumping around. libvlc defaults to 1 seconds of cache; let's increase it to 10 seconds to cut down on the potential for audio stutters. 23.04 M +7 -0 src/audiowrapper_libvlc.cpp https://invent.kde.org/multimedia/elisa/commit/7848ea003340ce1e7269e3fa96396eaf17e3e77d
I’ve added the patch to the Debian package on top of 22.08.3 but it doesn’t solve the issue. It makes it less frequent but I still have occasional sound cuts on an otherwise idle modern machine. I’ve not looked at the code but if the stutter is due to the playback directly waiting for the data to load from the disk, the correct solution is not to make the buffer bigger, it’s only going to make it less frequent. Also loading complete files in memory is not the solution either. I have a couple of albums that are a single FLAC file of a couple hundres of MBs and it seems overkill to load these entirely into memory. If the issue is really the playback buffer becoming empty, the real fix would be to ensure the prefetch is done in the background so the playback never ends up waiting for the data to be there. Thanks for looking into this !
(In reply to Aurélien COUDERC from comment #3) > I’ve added the patch to the Debian package on top of 22.08.3 but it doesn’t > solve the issue. It makes it less frequent but I still have occasional sound > cuts on an otherwise idle modern machine. > > I’ve not looked at the code but if the stutter is due to the playback > directly waiting for the data to load from the disk, the correct solution is > not to make the buffer bigger, it’s only going to make it less frequent. > Also loading complete files in memory is not the solution either. I have a > couple of albums that are a single FLAC file of a couple hundres of MBs and > it seems overkill to load these entirely into memory. > > If the issue is really the playback buffer becoming empty, the real fix > would be to ensure the prefetch is done in the background so the playback > never ends up waiting for the data to be there. > > > Thanks for looking into this ! I have not analysed *all* the remaining issues i heard, but at least some of them were artifacts in the audio itself. Are you sure that is not the case for you?
After more testing it seems to be limited to some files and the stuttering is reproducible for the same file and timestamp with all VLC-based apps. Mplayer doesn’t choke on the same files. I will do more testing and report but I guess from an Elisa standpoint you can close the bug. Thanks !
Sounds like a libvlc issue, perhaps.
(In reply to Nate Graham from comment #6) > Sounds like a libvlc issue, perhaps. You know what, why don't we just switch to libvlc backend?
(In reply to Roman Lebedev from comment #7) > (In reply to Nate Graham from comment #6) > > Sounds like a libvlc issue, perhaps. > > You know what, why don't we just switch to libvlc backend? Err. Of course, i meant libmpv.
(In reply to Roman Lebedev from comment #8) > (In reply to Roman Lebedev from comment #7) > > (In reply to Nate Graham from comment #6) > > > Sounds like a libvlc issue, perhaps. > > > > You know what, why don't we just switch to libvlc backend? > > Err. Of course, i meant libmpv. https://invent.kde.org/multimedia/elisa/-/merge_requests/400 Testing welcomed.
For reference there’s an upstream bug referencing the FLAC stuttering issue in VLC/libvlc here : https://code.videolan.org/videolan/vlc/-/issues/27454 And a fix : https://code.videolan.org/videolan/vlc/-/merge_requests/2918/diffs That we’ve applied to the Debian sources on top of 3.0.18 with a minor fix here : https://salsa.debian.org/multimedia-team/vlc/-/commit/c5289e84e17421c1e40ef9f0953b6c0f96a20cb2
Oh great! Roman, can you try to patch your VLC sources (if your distro isn't already offering that fix, of course) and see if it fixes the issue?
*** Bug 466735 has been marked as a duplicate of this bug. ***
I have the same issue. Version 23.08.2 Mpv plays flac well, Elisa stutters(sometimes way too often).
I forgot to update vlc, now everything is good, sorry.