Hello folks, thanks for liquidsoap. I'm very glad someone created a streaming
engine written in a functional language.
Earlier this summer I set up a server for a micropower radio station in a
remote location.
It's running an old 3Ghz P4 with 2GB RAM, Ubuntu 10.04, and airtime.
They wanted a jukebox for times there was no scheduled show playing, so, rather
than tweak airtime, I set up a separate liquidsoap instance that ran a custom
script. The script is below.
It basically plays a jukebox, but falls forward to a live stream or to airtime,
if either of those become available. It worked for a month or two flawlessly.
The problem is, after a few months running, that it'd periodically stutter
approximately 400ms of audio endlessly, then after 10-60 seconds move on to
another frame, stutter that one, then it'd do a scrambled-sounding insane thing
that sounds like an mp3 stream seeking past its key frame, then go back to
stuttering, for hours. The problem would clear itself after some hours had
passed. CPU usage was minimal at those times. There's no RT kernel, but I had
liquidsiap nice'd -20 so it ran with higher priority than anything. The problem
seems to happen randomly, intermittendly, typically once or twice a day, at no
predictable time, and regardless of whether the active source is the jukebox,
the livestream, or the airtime stream.
The logs all look completely normal, no errors, no overruns, etc. At one point
I did see an overrun, at the point where the error STOPPED happening, not when
it started, which was odd. At the time that it's stuttering, the jukebox (or
livestream, or airtime), looks like it's just cruising along doing what it's
supposed to be doing.
This was with Ubuntu's (old) liquidsoap package. I built a custom
liquidsoap-1.0.1 from source, installed it, and ran that.... and it did not
solve the problem.
I've since ditched the separate liquidsoap instance completely, and now run
these functions from inside airtime. It did not solve the problem.
I asked on the linux audio list, and one of the ALSA devs pointed out that
stuttering is caused by the application not sending data to the driver, so the
hardware just keeps playing the same frame over and over again until it gets a
new one from the application. But this isn't one frame (~40ms) it's a 400ms
chunk. And the error indicates something more complex.
Since this is airtime, I'm certain I'll get at least one reply telling me to go
ask the Airtime people. They, in turn, sent me here. I did just today upgrade
to airtime 2.2 which uses liquidsoap 1.0.1, but I didn't see any issues related
to this problem, or anything in the changelog indicating it fixed it. Though,
they are now using mp3replaygain in this new version, so CPU usage has gone sky
high. I'll know by tomorrow if the upgrade fixed anything.
My questions are:
1) Are there any things in the below script that look like the could cause
liquidsoap to do this crazy thing? I am not new to functional programming or
linux audio, but I am new to liquidsoap. Am I doing anything obviously wrong in
the code below?
2) How would I find out when is happening, or that it had happened? I found the
rms() command, which looks like it could be helpful for detecting silence. But
what unit of sound is this 400ms chunk? What cuts it up into those size hunks?
Is there some way to compare whether two or more sequential blocks like that
are exactly equal to each other (and flag it perhaps as an error)?
3) How could I get more data as to what exactly is wrong?
Thanks!
-ken
--
---------
#!/usr/bin/liquidsoap
set("server.telnet", true)
set("server.telnet.port", 4321)
set("log.file.path","/var/log/liquidsoap/jukebox.log")
set("log.stdout", true)
## lifted from airtime
def transition(a,b) =
source.skip(a)
# This eats the last remaining frame from a
sequence([a,b])
end
stationid = playlist(reload=86400, "/home/station-ids")
# check both drop and imported locations,
# just in case something screws up via airtime
jukebox =
random(weights=[1,10],
[stationid,
mksafe(random([playlist(reload=86400, "/home/imports"),
playlist(reload=86400, "/srv/airtime/stor")]))])
# strip blank hack, in case someone leaves their stream on with nothing sending
spaz = strip_blank(threshold=-80.0,
length=20.0,
input.http(buffer=30.0,
timeout=20.0,
max=240.0,
"http://stream.spaz.org:8050/stream"))
# this is the master control for the stream right here.
# the sources are listed in priority order
default = fallback(track_sensitive=false,
transitions=[transition,transition],
[spaz,
jukebox])
output.alsa(default)
------------------------------------------------------------------------------
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users