Updated: August 21, 2020
Welcome to Arcane Weekly! In today's corner on Linux problems what bother me, I want to talk to you about a rather curious usecase. So, you have a Plasma desktop environment, and you're using the Dolphin file manager. You use it to access Windows share via Samba. Then, you want to play an odd video clip, stored on the said Samba shares, and you open it in VLC. Sometimes this works, and sometimes, it doesn't.
I've encountered this problem in recent months - and it does not seem to be restricted to any particular version of Plasma, although I've seen this primarily in later editions - like Plasma 5.17 and Plasma 5.18. Things have improved a fair deal, especially the whole local caching business, but the intermittent playback issues still persist. You try to play the file, and then simply nothing happens. But on other occasions, this works just fine. Let's debug.
Problem in more detail
Since there's nothing really to indicate what goes wrong behind the scenes in VLC - as it simply does not play the file, we need more information. The best way to do this is to launch the media player from the command line, and then check for any errors. Lo and behold, this is what you get:
smb stream error: read failed (Software caused connection abort)
It doesn't really say much - and the Internet has a lot to share on this topic, but most of the issues and proposed solutions do not seem to be definitive. However, it points to a problem with the data read. I guess, Dolphin is trying to grab a chunk of data from the share, but somehow, this doesn't work. A hint there, and off we go exploring.
After a lot of digging, I did find a VLC bug, which seems to nail it down. The problem seems to occur in more recent builds of the media player, specifically version 3.0.8 and above. This coincides with the many changes introduced in Plasma, which compound the problem. Furthermore, the problem - while VLC specific - is also Plasma specific, because the same builds of VLC work fine in Xfce and Gnome desktops, which use GVFS for remote connections, as opposed to KIO used in Plasma.
VLC 3.0.8 changes the prefetch read value - which seems to trigger an odd behavior in Plasma. You can check and tune the value in VLC preferences. Show all settings > Streams filters > prefetch. Then, by default, you will notice that the Buffer size is set to 16 KB whereas the Read size is set to 16 MB. If you change the Read value to match the Buffer value, and restart VLC, it will now behave normally and play files from Samba shares without any connection abort errors.
Many thanks to the the person who actually found this - the avatar Harvester is quite appropriate, as the person went about digging, and found the solution, ha ha, hi hi. Now, what we have here is two factors. The VLC version plays a part. However, the issue is also Plasma only, plus it happens in newer versions, although we cannot disassociate the development in both frameworks in parallel, which would explain why you wouldn't or couldn't witness this in older Plasma releases. This means there are three conditions that need to happen for you to witness this. Compound issues are never fun to troubleshoot.
I hope the remote share connectivity stack in Plasma will be fully fixed soon, because it currently lags behind the other desktop environments, since there, one does need to worry what buffer/read value a media player may set. It's far more transparent, and it should be that way. The bug tracker is useful, but I'm afraid not too many people will see it, plus the underlying bug conditions still remain. But hopefully, this resolves your issue, and we're done here.