Hi there,
I was wondering if there is a way to get liquidsoap faster. Here is
the case :
I'm running on ubuntu server 8.04. The script has to read an ogg
stream and has 2 local playlist filled with mp3's in case of stream
failure. It also has a request.queue to be able to add some
annoucement and a little custom smart_cross transition helped with an
map_metadata.the whole system call a python script on_metadata which
fork itself to release a faster as possible the main thread. (Since
it was not called during my test, I don't believe he is faulty).
Finally, there are 2 outputs, one on ogg files (mono, 32kbps, cbr) and
one on the sound card.
The machine is a Pentium III running at 733Mhz with 128Mb of memory
(not a lot of memory but top says liquidsoap only use 30% of it...)
and liquidsoap is running with a nice level of -5.
The problem is that when I run liquidsoap with ouput.alsa, I get a
"catchup" of about 0.25 seconds about 6 time per minutes but, if I use
output.ao, I falls at 3 every track change! I don't know what's the
difference between both off them but if there is a way to have to get
liquidsoap even faster on this machine (without disabling the file
output, which actually works) I'll be happy to know them.
Thanks,
Simon
Here is the main code :
# importation
%include "config.liq.aux"
%include "top.liq.aux"
# mise à jour du status de l'antenne
def updateStatus(meta)
# Le script qui sera exécuté ici devra être RAPIDE car tournant dans
le thread principal!
# system()
x = string.ref("")
get = fst(x)
set = snd(x)
def makeArgs(meta)
def replacer(txt)
"<apo/>"
end
txt = "<Tag>"^fst(meta)^"="^snd(meta)^"</Tag>"
txt = string.replace(pattern="'", replacer, txt)
set("'"^txt^"' "^get())
end
list.iter(makeArgs, meta)
log(get())
system(metaUpdaterCommand^" "^get())
end
# Structure radio
jingles = playlist.safe(DB^"/safe/jingles/")
playlist = playlist.safe(DB^"/safe/songs/")
# le(s) jingles de pub
inPubJingle = single(DB^"/safe/colle/introPub.mp3")
outPubJingle = single(DB^"/safe/colle/extroPub.mp3")
secours = random(weights=[4, 1], [playlist, jingles])
main = strip_blank(length=15., input.http(id="mainStream", buffer=30.,
max=50., mainStream))
decro = strip_blank(length=15., input.http(id="decroStream",
autostart=false, buffer=2., decroStream))
# Here, we use 2 dummy output whose main goal is to avoid buffering
when reading pub
output.dummy(mksafe(main))
output.dummy(mksafe(decro))
radio= map_metadata(setSourceMeta("radio"),
fallback(transitions =
[crossfade, crossfade, crossfade],
track_sensitive=false, [decro, main, secours]))
pub = map_metadata(setSourceMeta("pub"), request.queue(id="pub"))
def backRadio(s)
def tr(Vp, Vn, Mp, Mn, p, n)
if list.assoc("source", Mn) == list.assoc("source", Mp)
then sequence([p,n])
elsif list.assoc("source", Mn) == "clock"
then add(normalize=false,
[ sequence([ blank(duration=2.), n]),
fade.final(duration=2.,p) ])
elsif list.assoc("source", Mn) == "pub"
then add(normalize=false,
[sequence([blank(duration=1.),once(inPubJingle),n]),
fade.final(duration=2.,p)])
elsif list.assoc("source", Mp) == "clock" and
list.assoc("source",
Mn)=="radio"
then add(normalize=false,
[ sequence([ blank(duration=1.),
fade.initial(duration=2.,n)]),
p ])
elsif list.assoc("source", Mp) == "pub" and
list.assoc("source",
Mn)=="radio"
then add(normalize=false,
[ sequence([ blank(duration=4.),
fade.initial(duration=3.,n)]),
sequence([ blank(duration=2.),
once(outPubJingle)]),
p])
else sequence([p,n])
end
end
smart_cross(width=2., duration=2., conservative=true, tr, s)
end
ClockedRadio = backRadio(fallback(
track_sensitive=false,
[map_metadata(setSourceMeta("clock"), clock),
pub, radio]))
out = on_metadata(updateStatus, ClockedRadio)
output.file.vorbis.cbr(stereo=false, bitrate=32, reopen_when={0m},
DB^"backup/%Y/%m/%d/%H.%M.%S.ogg", out)
output.ao(out)
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users