Bear with me, this is messy and weird.

Basic problem: stuttering; and it's worse with some songs than others.
Only the actual SB classics stutter - I just set up squeezelite on a
piCorePlayer and it doesn't stutter. On the Classics, the stutter is
worse on some units than others. Donn't prejudge the problem: it's not
network bandwidth, and the Classic that's on wifi stutters the least.

I want to keep the classics going as long as I can, because my wife is
used to using the remote and the menus on the display.

Now for the many weird aspects. First of all, all the Classics are on
rev 81 of the firmware. Why so old? Because I'm not using LMS. I'm using
a custom server that understands the protocol used in version 81, and
for complicated reasons I'll skip over unless asked, that aspect won't
change. I'm very wedded to the custom server, and my wife is very wedded
to the completely custom way it displays menus and other info on the
classic. PiCore and Squeezelite wont' be an option for her, at least
until I have a way to display a facsimile of those menus.

Second, when I ran my server on a raspberry pi, there were no stutters,
in about 10 years of use. I recently moved it to a NUC, a much faster
system, and that's when the stuttering started - very rarely for some
players and some some songs, but horribly often for one particular song
and a couple of players. (One solution is to move the server back onto a
pi, but I'd like to avoid that.)

Since it's my own server, I can instrument it however I like, so I
measured the timing for reading chunks from the music file, and how long
it took to send each chunk over the network. 

Reading the file isn't a problem: Reading 64k at a time from an internal
SSD disk, the NUC is spending between 28 to maybe 60 microseconds to
load each buffer, with very occasional spikes as high as 1.3
milliseconds. The average is around 40 microseconds. Reading is fine.

Writing over the socket is where the problem is. When I use the piCore
player, I get exactly what I expect: when a song first starts loading to
the piCore, socket writes happen quickly, with a peak of maybe 3
milliseconds to write each 64k, usually rather less. But the squeezelite
fills its internal buffer, and reads less often, so the TCP stream backs
up as expected. Socket writes in the server start blocking, waiting for
the TCP stream to unjam. So I'll get a write time like 1093 milliseconds
or 786 milliseconds, followed by something much faster for the next 64k
chunk, like 108 -microseconds-. This is just what I'd expect - as
squeezelite uses up it's buffer, it gets more interested in doing TCP
reads, which unblocks the server to quickly ship enough to top off
squeezelite again. All is perfect.

But when I move that same ethernet cable to a classic (running firmware
81), the socket writes are a completely different story. There no
initial inrush of buffers, and no alternating between slow and fast send
times. Every send is in the hundreds of milliseconds. It's as if the
Classic isn't bothering to read from the socket very often, so it stalls
on its own buffer being empty. And it's simple to test for this theory:
if I just pause the music, the server keeps sending buffers, so when I
unpause there's a period of unstuttering play.

I could believe the classic just isn't getting around to reading the
socket often enough, but when the server ran on a raspberry pi this
never happened. 

All I can come up with is that there's some difference between the TCP
stack of a raspberry pi and this NUC (linux mint) and somehow the
classic is sensitive to it (and picore isn't), but that seems like a
fringe theory. Note that I've tried this with different buffers sizes,
and with nagle enabled and disabled. Still stutters.

I know the next step is to move the server back to a pi and see if the
problem goes away again. Or move all the classics up to a more recent
firmware and see if something changed.

Does anyone have any insight into what could cause this?


------------------------------------------------------------------------
ScottAM's Profile: http://forums.slimdevices.com/member.php?userid=69412
View this thread: http://forums.slimdevices.com/showthread.php?t=110986

_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to