On Tue, 19 Apr 2011 18:52:51 -0500
Romain Beauxis <[email protected]> wrote:
> Your code seem to work here.. Do you have any logs to show? Does it
> work in non-daemonized mode?
>
> I would suggests investigating a possible segfault related to lame.
> This has happen in the past with similar consequences..
Actually, I investigated further, and it seems this is a bug of liquidsoap,
but it's quite difficult to reproduce:
OK, first, I have defined a telnet console:
### TELNET
set("server.telnet.bind_addr", "0.0.0.0")
set("server.telnet", true)
set("server.telnet.port", 4023)
Then, I have defined a function to get the audio stream out of an video
played with mplayer:
# Stream data from mplayer with timeouts for sources
# @category Source / Input
# @param s data URI.
# @param ~restart_on_error restart on exit with error.
# @param ~buffer Duration of the pre-buffered data.
# @param ~max Maximum duration of the buffered data.
# @param ~timeout timeout between playing attempts.
# @param ~mppid PID file where mplayer PID should be written.
# @param ~pid PID file of the patient loop.
def input.patient_mplayer( ~id = "input.patient_mplayer",
~restart_on_error = false,
~buffer = 2.0, ~max = 10.,
~timeout = 10, ~mppid = "mplayer.pid",
~pid = "patient_mplayer.pid",
s ) =
input.external( id = id, restart = true, restart_on_error =
restart_on_error, buffer = buffer, max = max,
"patient_mplayer.sh #{quote(s)}
#{quote(string_of(timeout))} #{quote(mppid)} #{quote(pid)}" )
end
OK, now, this function is used somewhere down the road, to get the source:
video = input.patient_mplayer( restart_on_error = true,
mppid =
"/usr/local/var/e-tunes.net/run/mplayer.pid",
pid =
"/usr/local/var/e-tunes.net/run/patient_mplayer.pid",
"http://localhost:4100" )
But this is where the error must sneak in somehow. As you can se here,
there's no mentioning of the telnet port. All that is passed to
patient_mplayer.sh, is "http://localhost:4100" as port information.
Now, patient_mplater.sh is just a tiny wrapper script, to pry audio and
video apart using mplayer:
#!/bin/bash
# $1 URI
# $2 timeout
# $3 mplayer PID file
# $4 own PID file
echo $$ > $4
while true; do
mplayer_pid.sh $$ $3 &
mplayer -nocache -really-quiet -ao pcm:file=/dev/stdout -vc null -vo null
$1 2>/dev/null
RET=$?
# [ $RET -ne 0 ] && exit $RET
sleep $2
done
OK, now here's how the error surfaces:
When starting the liq script, with the functions and definitions above, the
script that is running input.external() makes a weird action:
This is the 'ps aux' output for patient_mplater.sh. As you can see,
parameters get passed fine, etc. The second line is the actual script
itself running, the first line is liquidsoap executing input.external:
108 23210 0.0 0.0 4148 576 ? S 11:22 0:00 /bin/sh -c
patient_mplayer.sh 'http://localhost:4100' '10'
'/usr/local/var/e-tunes.net/run/mplayer.pid'
'/usr/local/var/e-tunes.net/run/patient_mplayer.pid'
108 23212 0.0 0.0 12192 1392 ? S 11:22 0:00 /bin/bash
/usr/local/bin/patient_mplayer.sh http://localhost:4100 10
/usr/local/var/e-tunes.net/run/mplayer.pid
/usr/local/var/e-tunes.net/run/patient_mplayer.pid
OK, now this is, what netstat reports on PID 23210 (the input.external PID of
liquidsoap):
tcp 0 0 0.0.0.0:4023 0.0.0.0:* LISTEN
108 339931584 23210/sh
As you can see, for some reason, the command running my script listens to
port 4023, which is my telnet port!
It was defined nowhere, but liquidsoap does it all by itself.
of course, now that the port is taken, liquidsoap fails at the end:
init: exception encountered during start phase:
Failure("port 4023 already taken")
What the hell is going on here? It used to work in the 0.9.x versions, now
that I've moved to the 1.x.x versions, it makes those weird things.
The only way for me to circumvent this problem, is to deactivate the
telnet console. But I need that one for metadata updates, etc.
The other solution would be deactivating the video thingy with mplayer.
But I need that one as well, since I need the video stream.
--
echo "[email protected]" | tr '[a-z]' '[n-za-m]'
------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve
application availability and disaster protection. Learn more about boosting
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users